Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

OSX Lion InstaDMG First Boot Part 3

October 11, 2011 4 Comments

custom-settings-instadmg-10-lion-osx

InstaDMG Part 3

After tutorials Part 1 & Part 2 with InstaDMG which deal with doing a basic OSX Lion 10.7 build and then introducing a user account and clearing the set up assistants, time to tweak some preferences on OSX 10.7 for the first time boot to include elements such as computer name, network, time zone and set applications preferences for Safari and the Finder.

The only tool you will need is Apple’s PackageMaker application which is part of the Auxiliary Tools for Xcode 4.3.2  and is available for a free download at the developer site at Apple, sign up for free and look for Auxiliary Tools for Xcode in the downloads section. Once the Auxiliary .dmg is downloaded just copy all the contents  to the Applications folder – to keep things in a sensible order make a folder called Xcode Tools and copy the contents into that – from there PackageMaker can be accessed.

xcode-package-maker

xcode-package-maker

Steps

  • Step 1 Download firstboot.dmg
  • Step 2 a) Rename files quick
  • Step 2 b) Rename files long
  • Step 3) Customise firstboot.sh
  • Step 4) Customise postflight.sh
  • Step 5) PackageMaker Build
  • Step 6) Checksum
  • Step 7) Add to catalog
  • Step 8 ) InstaDMG Build

Download FirstBoot Package

Required for this exercise is the firstboot package script, available here which can be customized to your needs, this has been made available courtesy of Nate Walck at osxdeployment.com The package contains a directory structure which needs to be maintained, 2 key scripts; firstboot.sh and postflight.sh that customize settings for the image that you are building, firstboot.sh sets up a lot of workstation variables such as names/networks/date & time etc and the postflight.sh sets up any custom preferences such as preferences to the Desktop and applications like Safari. Download the firstboot.dmg, open it, copy the contents into a new folder named ‘firstboot’, the key thing here is to rename a couple of components to your environment, set your preferences in the scripts, package the scripts and then use as an install package to be included with InstaDMG build process.

Rename the Required Files to your Environment

Easy Smart Way

instadmg-plist-script

instadmg-plist-script

Open:

firstboot/ROOT/Library/LaunchDaemons/edu.someuni.firstboot.plist

It will open in Xcode if installed otherwise edit it in a text editor – change /Library/Scripts/Company/firstboot.sh to /Library/Scripts/SomeUni/firstboot.sh Then move onto customising the scripts.

Official Way

Rename this file to your type of domain: firstboot/ROOT/Library/LaunchDaemons/edu.someuni.firstboot.plist Edit the same file and change the label string as below:

<key>Label</key>
	<string>com.yourdomain.firstboot</string>

Rename the directory below to your company name: /Library/Scripts/CompanyName/ Next edit the firstboot.sh file, change line 34 to reflect the string from above –

srm /Library/LaunchDaemons/com.company.firstboot.plist

Customising The Scripts

firstboot.sh

Path – firstboot/ROOT/Library/Scripts/SomeUni/firstboot.sh

In the firstboot.shyou can edit to suit your environment, couple of things you may wish to add:

#Removes Time Machine from the menu
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup 1
#Sets HostName of the Machine
scutil --set HostName $(scutil --get LocalHostName)
scutil --set ComputerName YourComputerNameHere
#disable ipv6
$networksetup -setv6off Ethernet
#Enable Airport
$networksetup -setnetworkserviceenabled AirPort on
# Activate WakeOnLAN.
$systemsetup -setwakeonnetworkaccess on
# ARD Configuration #Enable ARD for localadmin
$kickstart -configure -allowAccessFor -specifiedUsers
$kickstart -activate -configure -access -on -users "ladmin" -privs -all -restart -agent
# Set time zone and time server.
$systemsetup -setusingnetworktime on
$systemsetup -settimezone Australia/Sydney -setnetworktimeserver time.asia.apple.com

Just note in the ARD configuration options you need to specify which user to allow for Remote Deskop, the user example here follows on from the user account in part 2 “ladmin”. Full examples found here.

postflight.sh

Path – firstboot/scripts/postflight.sh

In the postflight.sh, some examples below, set your default home page in Safari:

# Set Safari Preferences.

$defaults write "${USERPREFS_DIR}/com.apple.Safari" HomePage http://www.bbc.co.uk/
$defaults write "${USERPREFS_DIR}/com.apple.Safari" ShowStatusBar -bool YES

Show mounted sharepoints in the Finder:

# Set Finder Preferences.
$defaults write "${USERPREFS_DIR}/com.apple.finder" ShowMountedServersOnDesktop -bool YES

Turn off the Firewall

#Firewall Settings | 0 = Off | 1 = On For Specific Services | 2 = On For Essential Services
sudo defaults write "${PREFS_DIR}/com.apple.alf" globalstate -int 0

Turn on Bluetooth

# Turn on Bluetooth
sudo defaults write "${PREFS_DIR}/com.apple.Bluetooth" ControllerPowerState -bool YES

More examples found here.

Once the 2 script files have been edited, save them and then its time to make the package.

Making the Package with PackageMaker

Open the firstboot/firstboot.pmdoc which will open PackageMaker, click on the contents arrow to see the enclosed 2 files, these files need to have specific ownership and permissions:

packagemaker contents for firstboot

packagemaker contents for firstboot

 

These files need to have root and wheel as the owner and group and the permissions must be set as 754, this is very important as otherwise they won’t execute, click on each file then the contents tab, then the file in the main window, then set the owner and group and permissions at the bottom left to be the same as below.

 

plist file permissions in packagemaker

plist file permissions in packagemaker

 

 

firstboot file permissions in packagemaker

firstboot file permissions in packagemaker

 

If you had changed the name of these files to match your company name and reverse domain you will also need to update them where applicable in PackageMaker, in the Configuration tab in the fields, install, destination and package identifier. If you left the value as ‘SomeUni’ you do not need to change any values. The postscript.sh script is located in the scripts tab of the firstboot.sh, it needs no change.

postflight-script-packagemaker

postflight-script-packagemaker

 

Click on the ‘Build‘ icon in the top right and save the package in your InstaDMG packages folder, from the previous tutorial this was installed in the home directory:

~/InstaDMG/InstallerFiles/InstaUp2DatePackages/
build-firstboot-package

build-firstboot-package

Checksum

The final piece is to checksum the new pacakge and add it to the catalog and then run the InstaDMG build. To checksum a single package:

cd ~/InstaDMG/Addons/InstaUp2Date/ ./checksum.py ~/InstaDMG/InstallerFiles/InstaUp2DatePackages/Firstboot.mpkg

Output similar to:

Firstboot Firstboot.mpkg sha1:0248348dc4008f9df34e045b8cb1079a9d83b6e8

Catalog

Add the output to your lion catalog, this example uses “LionExtras.catalog” and is filed in:

~/InstaDMG/AddOns/InstaUp2Date/CatalogFiles
# This is the catalog for the Addon LionExtras Settings - include-file: 10.7_vanilla.catalog Third Party Software: clearReg clearReg.pkg sha1:b0ba0f6bfd26956562e286bbcdfa8f78dd3722eb CreateLionUser CreateLionUser.pkg sha1:83b4357037d82a254c5ef068c384e3fb2c1 Firstboot Firstboot.mpkg sha1:0248348dc4008f9df34e045b8cb1079a9d83b6e8

lion-catalog-instadmg

lion-catalog-instadmg

InstaDMG Build

With those tasks done – you can run your catalog – build the image:

[~]: cd ~/InstaDMG/AddOns/InstaUp2Date/
[~]: sudo ./instaUp2Date.py -p LionExtras

Use the image and test any customisations you’ve made, if they haven’t taken verify the ownership and permissions are correctly set, if they are double check your naming convention of the required files.   Part 1   Part 2

Cats: Imaging, macOS, Tech Tags: image, instadmg, lion, OSX

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • What to expect from Apple’s Worldwide Developers Conference next week
  • Breaking down why Apple TVs are privacy advocates’ go-to streaming device
  • Musi says evidence shows Apple conspired with music industry on App Store ban
  • Trump threatens Apple with 25% tariff to force iPhone manufacturing into US
  • I helped a lost dog’s AirTag ping its owner: An ode to replaceable batteries

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

Copyright © 2025· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2025 · gee on Genesis Framework · WordPress · Log in