Firstboot Package Guide

From AFP548 Wiki
Jump to navigation Jump to search

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) -
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/ and /Library/Scripts/CompanyName/ 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" "">
<plist version="1.0">
  1. Change the /Library/Scripts/CompanyName folder to match your organization. (SomeUni for this guide).
  2. Open the 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/ 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 listed. Expand 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 and rename it for your org. edu.someuni.firstboot for this guide.
  4. Click 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. ( for us)
  5. Click the firstboot item on the left and change the scripts direction to your org name (ROOT/Library/Scripts/SomeUni/ as well as the destination (/Library/Scripts/SomeUni/). Also change the pkg identifier for this item (edu.someuni.firstboot.firstboot.pkg.
  6. 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.
  7. 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: