nbalonso.com

The Luggage: Pack OSX Unix Style

| Comments

This is going to be a quick article because I did not have much time to use this application, but after reading this and the guide in GitHub you should have a good understanding of what is this tool.

Following the entry for the automate things more, I like to introduce you to The Luggage. This is an command line application written by Joe Block while working at Google to automate the creation of Mac OSX installers. The final goal of this would be to create a recipe so that the task can be reproduced with no variation and getting the same result every time.

This makes easy to share the makefiles (or recipes :P) between other administrators and contribute in a more open source way.

Not to mention how painful is to use Apple’s PackageMaker

So my first approach to this tool was to create a Makefile that downloads Adobe Flash, decompresses it and repackages it in a friendly way to use with InstaDMG.

I have carefully made sure that the file permissions are equal to the original Adobe installer, and that the recipe is also the same so Munki administrators don’t face problems.

Let me guide you through this one as an example

1
include /usr/local/share/luggage/luggage.make

This line should alway be there for an obvious reason.

1
2
3
TITLE=FlashPlayer
# NOT WORKING  PKGDESCRIPTION=PlugIn
REVERSE_DOMAIN=com.adobe.pkg

imitating Adobes installer

1
PACKAGE_VERSION=11.3.300.265

The only variable to change manually that stores the desired version

1
PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker

With the new Apple’s Xcode location and the extra tools installed manually you need to tell The Luggage where PackageMaker is

1
2
3
4
5
6
PAYLOAD=  \
          get-flash \
          create-dirs \
          copy-files \
          fix-permissions \
          clean-the-house

List of the steps in order (we are among friends here so you can call them functions)

1
2
3
4
5
6
get-flash:
curl -L "http://fpdownload.macromedia.com/get/flashplayer/pdc/${PACKAGE_VERSION}/install_flash_player_osx.dmg" -o "install_flash_player_osx.dmg"
hdiutil attach ./install_flash_player_osx.dmg -mountpoint /Volumes/LuggageFlash -nobrowse -noautoopen
gunzip -c /Volumes/LuggageFlash/Install\ Adobe\ Flash\ Player.app/Contents/Resources/Adobe\ Flash\ Player.pkg/Contents/Archive.pax.gz > ./Archive.pax
tar -xf Archive.pax
mv Library/Internet\ Plug-Ins/Flash\ Player.plugin.lzma Library/Internet\ Plug-Ins/Flash\ Player.plugin

unix commands

1
2
3
4
5
create-dirs:
@sudo mkdir -p ${WORK_D}/Library/Application\ Support/Adobe/Flash\ Player\ Install\ Manager
@sudo mkdir -p ${WORK_D}/Library/Internet\ Plug-Ins
@sudo mkdir -p ${WORK_D}/Library/LaunchDaemons
@sudo mkdir -p ${WORK_D}/Library/PreferencePanes

Creating the directories that will hold the data. Note that we create these inside the final package that is why we use ${WORK_D}

1
2
3
4
5
6
copy-files:
@sudo ${CP} ./Library/Application\ Support/Adobe/Flash\ Player\ Install\ Manager/fpsaud ${WORK_D}/Library/Application\ Support/Adobe/Flash\ Player\ Install\ Manager
@sudo ${CP} -a ./Library/Internet\ Plug-Ins/Flash\ Player.plugin ${WORK_D}/Library/Internet\ Plug-Ins
@sudo ${CP} ./Library/Internet\ Plug-Ins/flashplayer.xpt ${WORK_D}/Library/Internet\ Plug-Ins
@sudo ${CP} ./Library/LaunchDaemons/com.adobe.fpsaud.plist ${WORK_D}/Library/LaunchDaemons
@sudo ${CP} -a ./Library/PreferencePanes/Flash\ Player.prefPane ${WORK_D}/Library/PreferencePanes

Putting everything inside the package where it should be

1
2
3
4
5
6
7
8
9
10
11
fix-permissions:
@sudo chown root:admin ${WORK_D}/Library/
@sudo chown -R root:admin ${WORK_D}/Library/Application\ Support/
@sudo chown -R root:admin ${WORK_D}/Library/Internet\ Plug-Ins/
@sudo chown -R root:wheel ${WORK_D}/Library/LaunchDaemons
@sudo chown -R root:wheel ${WORK_D}/Library/PreferencePanes
@sudo chmod g+w ${WORK_D}/Library/
@sudo chmod -R g+w ${WORK_D}/Library/Application\ Support/
@sudo chmod -R g+w ${WORK_D}/Library/Internet\ Plug-Ins/
@sudo chmod g+w ${WORK_D}/Library/LaunchDaemons/com.adobe.fpsaud.plist
@sudo chmod -R g+w ${WORK_D}/Library/PreferencePanes/Flash\ Player.prefPane

Fixing the permissions inside the package. I use here the Adobe installer as guide but they could be wrong once again

1
2
3
4
5
6
clean-the-house:
@sudo rm -rf ${WORK_D}/usr
rm Archive.pax
rm -rf ./Library
@sudo hdiutil detach /Volumes/LuggageFlash
rm install_flash_player_osx.dmg

Cleaning the files and removing the /usr that The Luggage creates by default

You can find more examples of The Luggage receipts in https://github.com/unixorn/luggage-examples and if you do create new ones be good and share (:

So now that we have the Makefile you just need to navigate to the folder containing this file and run “make pkg” to get our new re-packed FlashPlayer

Here the file if you want to download it.

PS: Maybe I should be covering first how to install The Luggage on the first place but I think is properly explained here https://github.com/unixorn/luggage/wiki/ and also contains many good tips that will make your life easier.

PS2: It should be easy enough to integrate a new function that creates a preference file to handle the automatic updates. Here a paste from the Munki postflight for you to add as homework

1
2
3
bash-3.2$ mkdir -p "/Library/Application Support/Macromedia"
bash-3.2$ echo "AutoUpdateDisable=0" > "/Library/Application Support/Macromedia/mms.cfg"
bash-3.2$ echo "SilentAutoUpdateEnable=0" >> "/Library/Application Support/Macromedia/mms.cfg"

Comments