First Boot Package Install.pkg
As covered previously, Greg Neagle’s createOSXinstallPkg is a versatile tool for installing or upgrading Mac OS X in a variety of situations. One of the nicer features is that you can edit the OS X installer to install additional packages.
However, the limitations of the OS X install environment mean that there are a number of installers that won’t install correctly. In particular, packages that rely on pre- or postflight scripts to perform important tasks may fail to run properly in the OS X install environment.
To help work around this limitation, I’ve developed First Boot Package Install.pkg, an installer package that enables other packages to be installed at first boot.
Update – 4-17-2014: An updated First Boot Package Install.pkg is now available. See this post for details. The repo address has also changed; links in this post have been updated.
It’s designed for use with createOSXinstallPkg with the goal of allowing installer packages that can’t run in the OS X Install environment to be used as part of a createOSXinstallPkg deployment workflow. See below the jump for the details.
Using First Boot Package Install.pkg’s pre-built installer package
1. Download the First_Boot_Package_Install.zip file from the installer directory in my GitHub repo
3. Go to Contents: Resources: fb_installers
4. Add one installer package to each numbered directory. The number of the directory indicates the install order, with 00 being the first.
NOTE: createOSXinstallPkg has an upper limit of 350 MBs of available space for added packages. This is sufficient space for basic configuration, payload-free or bootstrapping packages, but it’s not a good idea to add Microsoft Office or similar large installers to this installer.
As needed, more numbered directories may be added to the fb_installers directory. For numbers less than 10, make sure to label the directory with a leading zero (For example, 06).
Note: If installing more than 100 packages, be aware that this was beyond the scope of my testing. I recommend adding another leading zero where appropriate.
5. Once finished adding installers to the numbered directories, First Boot Package Install.pkg is ready to be added to a deployment workflow.
What’s supposed to happen
The installer package is designed to install packages in the desired order, then remove all traces. All actions occur before the OS X login window appears.
What the end-user sees
After the OS X install completes, it restarts and stays at the gray Apple loading screen for as long as it takes for the packages to install.
Once the install completes, the Mac automatically restarts and boots up normally to the login window.
When First Boot Package Install.pkg is installed via createOSXinstallPkg, it does the following:
1. Copies First Boot Package Install.pkg/Contents/Resources/fb_installers to /Users/Shared/fb_installers
2. Installs /Library/LaunchDaemons/com.company.firstbootpackageinstall.plist
3. Installs /var/firstbootpackageinstall.sh
After OS X is installed by createOSXinstallPkg and reboots, the following process occurs:
1. The com.company.firstbootpackageinstall LaunchDaemon triggers /var/firstbootpackageinstall.sh to run.
2. /var/firstbootpackageinstall.sh stops the login window from loading and checks for the existence of /Users/Shared/fb_installers.
If /Users/Shared/fb_installers is not found, the following actions take place:
A. The login window is allowed to load
B. /Library/LaunchDaemons/com.company.firstbootpackageinstall.plist is deleted
C. /var/firstbootpackageinstall.sh is deleted
If /Users/Shared/fb_installers is present, the following actions take place:
A. The packages are installed, using the numbered subdirectories to set the order of installation
B. Once installation has finished, /Users/Shared/fb_installers is deleted
C. The Mac is restarted
D. On restart, the “if /Users/Shared/fb_installers is not found” actions occur and all remaining traces of First Boot Package Install.pkg are removed from the Mac.
All First Boot Package Install.pkg components and scripts are available at my GitHub repo:
The Iceberg project files are also available via the link above if you want to build a customized First Boot Package Install.pkg for your own environment.