Re-packaging metapackages with Iceberg
One of the challenges that can crop up with deploying software packages can be repackaging metapackages, especially metapackages that don’t have the installers contained inside themselves. Good example of the latter is iLife ’11 and XCode 4.x, where the installer metapackage is small and instead acts as a master conductor to install other packages located in a separate directory.
To address this, you can use Iceberg‘s ability to add resources to a Iceberg-built package. Here’s an example, using an Office 2011 SP 1 installer metapackage and the Office 2011 14.1.2 Update.
To build, set up a new Iceberg project. Since we’ll need to run this installer with root privileges, I recommend setting the project type to Darwin: Package. That will open the project with the installation privileges automatically set to root. In this case, I’m naming the project Microsoft Office 2011 SP1 14.1.2
Once the Iceberg project opens, check the Settings section. You’ll want to make sure that the your information is filled in here (if you don’t know what to put in, check the Help menu for the Iceberg User Guide. The information you need is in Chapter 6 – Customizing component settings.)
You’ll also need to check the Options section, to make sure that Authorization: is set to Root Authorization.
Next, you’ll want to click on the Scripts section. In Scripts, scroll down as needed until you see the Additional Resources section. Now, go back to where you have your copies of the main Office 2011 installer and the 14.1.2 Update. Drag both installers into the Additional Resources section. (The order doesn’t matter.)
The last piece is telling the installers to run. For this, you’ll need a postflight script. Here’s the one I’m using:
sudo installer -dumplog -verbose -pkg "$1/Contents/Resources/Office 2011 with Service Pack 1 Installer.mpkg" -target /
sudo installer -dumplog -verbose -pkg "$1/Contents/Resources/Office 2011 14.1.2 Update.mpkg" -target /
Notice that the “$1/Contents/Resources” refers to the path to the package’s Resources folder. That’s where Iceberg will be storing these metapackage installers, in the installer’s embedded Contents/Resources directory. The script also governs what order the installers run in, so the main Office 2011 installer runs first and the update runs next after the first job finishes. The “-dumplog -verbose” flags are to help you track the progress of installation if you’re looking at the Installer log.
Once you’ve got the postflight script built, run the following command to make the script executable:
sudo chmod a+x /path/to/postflight
Once it’s been made executable, drag the script into the Installation Scripts section in the postflight line. Next, ensure the checkbox next to postflight is checked.
Last step, go ahead and build the package. (If you don’t know to build, check the Help menu for the Iceberg User Guide. The information you need is in Chapter 3 – Creating a package.)
Once the package has been built, test it by taking it to a test machine that doesn’t have the software on it and install. The end result should be that Office 2011 SP 1 installs and is fully up to date with the 14.1.2 update.