Firstboot Package Guide

From AFP548 Wiki
Revision as of 23:15, 20 August 2010 by 68.57.64.184 (talk)
Jump to navigation Jump to search

This guide will walk you through using the Firstboot Template.

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


  1. Download the PackageMaker Template: File:Firstboot.dmg. Double click to mount the .dmg once it is finished downloading.
  2. 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.
  3. Drag and drop the contents of the mounted Firstboot.dmg file into your ~/Desktop/firstboot folder.
  4. 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.
  5. 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
  6. 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>
  1. Change the /Library/Scripts/CompanyName folder to match your organization. (SomeUni for this guide).
  2. 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:
srm /Library/LaunchDaemons/edu.SomeUni.firstboot.plist
  1. Also take this moment to edit the ~/Desktop/firstboot/scripts/postflight.sh file to your liking.
  2. 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.
  3. Click com.company.firstbootand and rename it for your org. edu.someuni.firstboot for this guide.
  4. 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)
  5. 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.
  6. 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.