Packaging iWork ’09 for Munki

In case you have users who miss some of the functionality from iWork '09 and you happen to still have a copy, you may find useful this little rundown on how I packaged it for Munki.

munkifyiwork0901
As Greg Neagle mentions in this old Munki Dev mailing list thread, there is a .mpkg file on the disk, but it's just an alias for the actual .mpkg. I went with a version of Greg's second suggestion. Right-clicking the alias allowed me to Show Original.

munkifyiwork0902
Then I copied that original .mpkg to somewhere I could do a

munkiimport iWork09.mpkg
that will create a disk image container for the .mpkg file.

When I selected the name for the package, I initially made the mistake of putting the apostrophe in there. As of this writing, there is still an outstanding issue for Munki that it can't take apostrophes in package names, but that's supposed to be resolved in an upcoming release. The display name can still be iWork '09, but the actual name should be something more like iWork09.

munkifyiwork0903
Then there were a few more settings in the pkgsinfo .plist file I had to modify to get it to work properly.

Based on receipts alone, Munki couldn't tell iWork was installed when it was. (More details here on how Munki decides whether a package is installed or not.)

The best thing to do in this case is to make an installs array. You can run

makepkginfo -f /Applications/PATHTOAPP/NAMEOFAPP/Contents/MacOS/NAMEOFEXECUTABLE
to get the installs array. It should end up looking something like this when you piece it together (md5 hashes will be different, though):
<key>installs</key>
<array>
<dict>
<key>md5checksum</key>
<string>c101624d3491b3866a5ed4adf8f3c500</string>
<key>path</key>
<string>/Applications/iWork '09/Keynote.app/Contents/MacOS/Keynote</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>md5checksum</key>
<string>9541a756a0bac50b4075bf69fe362784</string>
<key>path</key>
<string>/Applications/iWork '09/Numbers.app/Contents/MacOS/Numbers</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>md5checksum</key>
<string>aece141af1cdae764146068b94649f20</string>
<key>path</key>
<string>/Applications/iWork '09/Pages.app/Contents/MacOS/Pages</string>
<key>type</key>
<string>file</string>
</dict>
</array>
If it sees that Keynote is there, Munki knows not to try to reinstall iWork '09.

The next bit wasn't strictly necessary, but I still found it nice to do.

<key>postinstall_script</key>
<string>#!/bin/bash
sudo defaults write /Library/Preferences/com.apple.iWork09 RegistrationHasBeenSent true
sudo defaults write /Library/Preferences/com.apple.iWork.numbers dontShowWhatsNew true
sudo defaults write /Library/Preferences/com.apple.iWork.pages dontShowWhatsNew true
sudo defaults write /Library/Preferences/com.apple.iWork.keynote dontShowWhatsNew true
</string>
By default, after you install iWork '09, all users will be prompted to register. You can actually preemptively turn that off but putting in a global .plist that registration has already been sent. Likewise, it seems silly to advertise to users what's "new" in iWork '09 when iWork '09 isn't new at all, and the most likely scenario for a user installing iWork '09 is that she knows exactly what features it has that are now missing from the new Keynote/Numbers/Pages, so she doesn't need to be reminded.

I found that I also had to manually remove some stuff after an uninstall, so I put this in, too:

<key>postuninstall_script</key>
<string>#!/bin/bash
sudo rm -r /Library/Application\ Support/iWork\ \'09
sudo rm -r /Applications/iWork\ \'09
</string>
It gets rid of the global application support files. It also gets rid of the launchers in the /Applications folder but oddly doesn't remove the iWork '09 folder itself (even though it will if you paste that command into the terminal on the client computer).

Not sure how many Mac admins still have users using iWork '09, but hopefully you'll find this tutorial helpful if you do have those users.

Leave a Reply

Your email address will not be published. Required fields are marked *