Firstboot Package Guide
Note: It is highly suggested that you use the firstboot script part of this package in your DeployStudio workflow as a postponed script (if you use DS). It is preferable to use DS to do firstboot scripts than placing a LaunchD item + Script using this package
This guide will walk you through using the Firstboot Template. This is generally used with InstaDMG for pre-staging settings.
Required for this tutorial:
Apple's PackageMaker (Part of Xcode) - https://developer.apple.com/iphone/download.action?path=%2Fios%2Fios_sdk_4.0.2__final%2Fxcode_3.2.3_and_ios_sdk_4.0.2.dmg
The PackageMaker Firstboot template - File:Firstboot.dmg
- Download the PackageMaker Template: File:Firstboot.dmg. Double click to mount the .dmg once it is finished downloading.
- Create a new folder named firstboot on your desktop. This folder can be anywhere, but we'll refer to it as being on the desktop for this guide.
- Drag and drop the contents of the mounted Firstboot.dmg file into your ~/Desktop/firstboot folder.
- In the firstboot folder, you will notice that there is a specific folder structure. The structure is not required to be this way, but I find that it is easier to keep track of the files within the Apple Package if they arranged in a logical fashion. The ROOT folder represents the root of the machine that this package will be installed on (Which for our purposes, will be the root of the InstaDMG image that we will install this package to). Within the ROOT folder, you will find /Library/LaunchDaemons/com.company.firstboot.plist and /Library/Scripts/CompanyName/firstboot.sh. There is also a scripts folder in the same directory as ROOT, it will contain our postflight script that will be executed after the contents of the package are delivered.
- The first thing we need to do with this template is customize it for your organization. Rename com.companyname.firstboot.plist so it matches your organizations name and type of internet domain. We will say we work for the SomeUni College, which is an .edu domain, so we would rename it to edu.someuni.firstboot.plist
- Open edu.someuni.firstboot.plist in your favorite text editor (TextWrangler is my preference). Change the label to match what you changed the file name to. Here is what SomeUni's edu.someuni.firstboot.plist would look like:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>edu.someuni.firstboot</string> <key>ProgramArguments</key> <array> <string>/Library/Scripts/SomeUni/firstboot.sh</string> </array> <key>QueueDirectories</key> <array/> <key>RunAtLoad</key> <true/> <key>WatchPaths</key> <array/> </dict> </plist>
- Change the /Library/Scripts/CompanyName folder to match your organization. (SomeUni for this guide).
- Open the firstboot.sh file that is within /Library/Scripts/SomeUni/ and add or remove whichever settings you need for your purposes (Examples here: Firstboot_Script_Commands. Change the second to last line so it matches the plist we edited above. SomeUni's would look have the following:
- Also take this moment to edit the ~/Desktop/firstboot/scripts/postflight.sh file to your liking.
- Now that the files are named properly and contain the right settings, double click the firstboot.pmdoc file to open it in PackageMaker. You will notice on the left hand side, there is a contents section, which has com.company.firstboot listed. Expand com.company.firstboot and it will reveal two files. Since we renamed the files in the folder, PackageMaker isn't quite sure where they went (As shown by the ? marks), so lets fix the file names.
- Click com.company.firstbootand and rename it for your org. edu.someuni.firstboot for this guide.
- Click com.company.firstboot and select the "Configuration" section. For the Install field, change the com.companyname.firstboot.plist to reflect what you renamed the file to. In our case, edu.someuni.firstboot.plist. Once you do this, you will see that the ? mark now turns into a page icon. Also under package identifier for this item, change it to your organization. (edu.someuni.firstboot.edu.someuni.firstboot.pkg for us)
- Click the firstboot item on the left and change the scripts direction to your org name (ROOT/Library/Scripts/SomeUni/firstboot.sh) as well as the destination (/Library/Scripts/SomeUni/). Also change the pkg identifier for this item (edu.someuni.firstboot.firstboot.pkg.
- Check the permissions on each item. Click each item on the left and select the contents section. The launchd item MUST be set to owner: root and group: wheel, permissions set to 754. If they are not set to this, the launchditem will never load the firstboot script. There are some issues with this and PackageMaker, so be 100% the permissions are set correctly and being applied correctly. I tested this and confirmed if the permissions are set correctly in PackageMaker, it *will* work.
- Save the Packagemaker .pmdoc. The firstbook .pkg is all done! Just click build and save it to wherever you'd like. It is now ready to be used with InstaUp2Date.
For more indepth documentation on using PackageMaker, see the PackageMaker documentation page on the Apple Dev website: http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/PackageMakerUserGuide/Introduction/Introduction.html