Home » Tech » Archive for category 'Mac'

Mac Archive

Mac OS X Disk Images

Posted 2013/10/10 By mikep345678

Create sparsebundle:
hdiutil create -size $SIZE -fs HFS+J -Volname $VOLNAME -type SPARSEBUNDLE $VOLNAME_backup

Convert to compressed sparsebundle:
hdiutil convert $VOLNAME_backup.sparsebundle -format UDBZ -o $VOLNAME_backup_compressed.sparsebundle.dmg

Mount read-only sparsebundle with read-write Shadow:
hdiutil attach -owners on $VOLNAME_backup_compressed.sparsebundle.dmg -mount required -shadow

Unmount:
hdiutil detach $VOLNAME

Commit changes in Shadow (can’t be done in-place; have to create new file):
hdiutil convert -format UDBZ -o $VOLNAME_backup_compressed_merged.sparsebundle.dmg $VOLNAME_backup_compressed.sparsebundle.dmg -shadow

Unix/Linux/OSX scripting

Posted 2012/08/18 By mikep345678

{stolen from here…}

Unix Shell Stuff
 


 

$# - Contains the number of arguments passed to the 
      program in the form of positional variables.

$* - Contains all the positional parameters passed to 
      the program.

$1-$9 - Positional parameters.

$0 - Contains the program name.

$$ - Contains the process ID of the current process.

$? - Contains the exit status of the last command executed. 

expr - Used to evaluate arguments as mathematical 
        expressions.  ex: CNT=`expr $CNT + 1` 

; - Used to separate commands on command line. 

\ - Used to continue the command on the next line.

\c - Used to suppress newline.
      ex: echo "Enter Name:\c" ; read name

read - Assigns the value entered into the given variable.
         ex: echo "Enter Name:"  
             read name

` ` - A command within grave accent marks returns 
       the output to the variable ex: DATE=`date`.

set - Set the values of the command line argument 
        variables ($1-$9) to it's arguments.

--   - No more options follow.

if expressions:
  if
  then
       Commands
   else
       Commands
  fi

   :     Null Character (always true)

   ;     Separates commands on one line 

   #!    As the first characters in the first line of shell script,
           tells OS that what follows, is the path to the shell to execute this script with.

   exec  Does not start an new process for the command being execed.
            Over lays the current process instead of starting new one.  Does not return control to shell.

   break Exits "for", "while" and "until" loop.

 


 

Testing Character Data:
 

 
   =   Equals, string comparisons ex: if [ "$str1" = "str2" ]; then    (equal)

   !=  Not equal, string comparisons ex: if [ "$str1" != "str2" ]; then    (not equal)

   -n string - True if the length of string is greater than 0 (is not null)

   -z string - True if string is null (has a length of 0)

   test - Test strings ex: test "$str" = "abc"

 


 

Testing Numeric Data:
 

     -eq -  Equals                      ex:  if [ $1 -eq 0 ]; then
     -ne -  Not equal                   ex:  if [ $1 -ne 0 ]; then
     -gt -  Greater than                ex:  if [ $1 -gt 0 ]; then
     -ge -  Greater than of equal to    ex:  if [ $1 -ge 0 ]; then
     -lt -  Less than                   ex:  if [ $1 -lt 0 ]; then
     -le -  Less than or equal to       ex:  if [ $1 -le 0 ]; then


Testing For Files:

     True if
        -r    Read permission           ex:  if [ -r $FILE ]; then
        -w    Write permission          ex:  if [ -w $FILE ]; then
        -x    Execute permission        ex:  if [ -x $FILE ]; then
        -f    Regular file              ex:  if [ -f $FILE ]; then
        -d    Directory                 ex:  if [ -d $FILE ]; then
        -c    Character special file    ex:  if [ -c $FILE ]; then
        -b    Block special file        ex:  if [ -b $FILE ]; then
        -s    File not zero             ex:  if [ -s $FILE ]; then
        -t    Terminal device           ex:  if [ -t $FILE ]; then
        -o    True if either (OR)       ex:  if [ ! -r $FILE  -o ! -f $FILE ]; then
        -a    True if both (AND)        ex:  if [ -r $FILE -a -f $FILE ]; then

lifted directly from http://www.randomsquared.com/post/22875358548

Mac OS X 10.7.4 SOE

In summary, here is my method for creating a Mac OS X 10.7.3 Standard Operating Environment “SOE” Image. Posted it over on my blogger page but leaning toward migrating to tumblr… so here goes.

  • Overview

    The goal is to create a “MASTER” non-booted SOE that can be used with multiple models and it multiple sites with different local requirements.

    My intention is to use this “MASTER” image in a manual restore procedure due to the fact netboot facilities cannot be made available to all the sites I support however the DMG files are netboot compatible.

  • Requirements
    1. Lion Recovery Disk Assistant v1.0
    2. “TARGET” workstation. A compatible workstation that will be used to install Mac OS X 10.7.3 and capture a DMG image(s).
    3. “ADMIN” workstation. A workstation with Disk Utility that you will use to capture your DMG image(s).
    4. External storage such as a USB HARD DISK.
  • Setup
    1. Downloaded the Lion Recovery Disk Assistant v1.0 and followed the instructions to setup an external Recovery Disk on an externally attached USB disk. Used a Shintaro Hard Drive Docker and multiple disks for convenience when building images.
    2. Booted the “TARGET” workstation from the Recovery Disk and installed Mac OS X 10.7 using a custom install. Depending on your environment it may not make sense to “Install nearby printers” as your LAN may not allow access to other sites so the installer won’t be able to see what other printers are on your network(s) anyway. I deploy specific printer drivers using my software deployment system rather than adding them to my image(s) as I support many sites.
    3. Once the install completed, rebooted the “TARGET” workstation into TARGET DISK mode, mounted it on the “ADMIN” workstation and captured a DMG. Labelled this DMGOSX_10.7_VANILLA.DMG, I can now restore this to a DMG to a disk and skip steps 1-3 when starting new images in the future.

      (If your “TARGET” workstation isn’t capable of booting into TARGET DISK mode you will need to capture your DMG whilst booted from the Recovery Disk. You may need to plugin additional storage such as a USB or FIREWIRE hard disk so you have somewhere to store the DMG image.)

    4. With the “TARGET” workstation still in TARGET DISK mode and mounted on the “ADMIN” workstation, I downloaded the 10.7.3 combo updater to the “ADMIN” workstation and applied it to the “TARGET” workstation. Using a combo updater will allow me to use the DMG image on multiple models and essentially use the image as a “MASTER”.
    5. Once the combo updater install completed, applied Apple specific Software Updates that can target a non-booted volume then I captured another image (I only apply the latest Java update). I labelled the DMG OSX_10.7.3_VANILLA.DMG, I can now restore this to a DMG to a disk and skip steps 1-5 when starting new images in the future.
    6. With the “TARGET” workstation still in TARGET DISK mode and mounted on the “ADMIN” workstation, copied the build.sh script to /var/root/build.sh on the “TARGET” workstation.
    7. With the “TARGET” workstation still in TARGET DISK mode and mounted on the “ADMIN” workstation, copied Apple Software Updates that require a boot volume into /var/root/Updates on the “TARGET” workstation. (I only apply Safari 5.1.5 and iTunes 10.6.1).
    8. Rebooted the “TARGET” workstation into SINGLE USER mode and executed /var/root/build.sh
    9. Rebooted the “TARGET” workstation into TARGET DISK mode, mounted it on the “ADMIN” workstation and captured a DMG. Labelled the DMG OSX_10.7.3_BUILD.DMG, I can now restore this to a DMG to a disk and skip steps 1-9 when starting new images in the future.
    10. With the “TARGET” workstation still in TARGET DISK mode and mounted on the “ADMIN” workstation, copied boot.sh and localise.sh scripts into /var/root on the “TARGET” workstation and captured a DMG. Labelled the DMG OSX_10.7.3_SOEvXXX.DMG, I can now restore this to a DMG to a disk and skip steps 1-10 when starting new images in the future.
  • Scripts
    • build.sh

      #* build.sh
      #+ Phase 1 of 3
      #+ Run this script via single user mode to prep a Mac OS X 10.7.3 install.
      
      #* PLIST BUDDY
      PB="/usr/libexec/PlistBuddy"
      
      #* Mount volume for writing.
      /sbin/mount -uw /
      
      #* Load Open Directory
      launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
      
      #* Avoid Setup Wizard.
      sudo /usr/bin/touch "/private/var/db/.AppleSetupDone"
      sudo /usr/sbin/chown root:wheel "/private/var/db/.AppleSetupDone"
      
      #* Avoid Registration Wizard.
      sudo /usr/bin/touch "/Library/Receipts/.SetupRegComplete"
      sudo /usr/sbin/chown root:wheel "/Library/Receipts/.SetupRegComplete"
      
      #* Default user preferences.
      #+ Modifies /System/Library/User Template
      #+ Note : com.apple.dock.plist, com.apple.LaunchServices.plist and com.apple.sidebarlists.plist are a bit complex and I'm too lazy to write them with plistbuddy so I supply them as payload items instead.
      #+ Be careful with com.apple.sidebarlists.com, make sure to remove the useritems dictionary as its not dynamic. 
      #+ Note : I set these prior to creating my local admin user accounts to that I can test them, you may not want to in case they are buggy.
      for USER_TEMPLATE in `sudo ls /System/Library/User\ Template`
      do
       if [ -r "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences" ]; then
        /bin/echo "Modifying /System/Library/User Template/${USER_TEMPLATE}/Library/Preferences"
        #+ com.apple.ATS.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.ATS" ATSAutoActivation -string ATSAutoActivationDisable
        #+ com.apple.desktop.plist
        sudo $PB -c 'Add Background:default:BackgroundColor array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist" 
        sudo $PB -c 'Add Background:default:BackgroundColor:0 real 0' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist"
        sudo $PB -c 'Add Background:default:BackgroundColor:1 real 0' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist"
        sudo $PB -c 'Add Background:default:BackgroundColor:2 real 0' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist"
        sudo $PB -c 'Add Background:default:DrawBackgroundColor bool true' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist"
        sudo $PB -c 'Add Background:default:ImageFilePath string ${BACKGROUND}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktop.plist"
        #+ com.apple.desktopservices.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.desktopservices" DSDontWriteNetworkStores -bool TRUE
        #+ com.apple.dock.plist (ugly but too complex for defaults or plistbuddy and I'm lazy)
        sudo /bin/cp -f "/var/root/com.apple.dock.plist" "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.dock.plist"
        #+ com.apple.DiskUtility.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.DiskUtility" advanced-image-options -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.DiskUtility" DUDebugMenuEnabled -bool YES
        #+ com.apple.finder.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" _FXShowPosixPathInTitle -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" FXDefaultSearchScope -string SCcf
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" FXPreferredViewStyle -string Nlsv
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" NewWindowTarget -string PfHm
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" ShowHardDrivesOnDesktop -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" ShowMountedServersOnDesktop -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" ShowRemovableMediaOnDesktop -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" ShowPathbar -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.finder" ShowStatusBar -bool YES
        #+ com.apple.FontBook.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.FontBook" FBValidateFontsBeforeInstalling -bool NO
        #+ com.apple.iTunes.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disableCheckForUpdates -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disableGeniusSidebar -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disableGetAlbumArtwork -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disablePing -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disablePingSidebar -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disablePodcasts -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disableRadio -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" disableSharedMusic -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" dontAutomaticallySyncIPods -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.iTunes" lookForSharedMusic -bool NO
        #+ com.apple.LaunchServices.plist (ugly but too complex for defaults or plistbuddy and I'm lazy)
        sudo /bin/cp -f "/var/root/com.apple.LaunchServices.plist" "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.LaunchServices.plist"
        #+ com.apple.NetworkBrowser.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.NetworkBrowser" BrowseAllInterfaces -bool NO
        #+ come.apple.Preview.plist
        #+ NOTE : Changed my mind, not touching this stuff till I play with some more scenarios.
        #sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Preview" ApplePersistenceIgnoreState YES
        #+ com.apple.Safari.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" ApplePersistenceIgnoreState YES
        # or...
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" NSQuitAlwaysKeepsWindows -int 0
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" AutoFillFromAddressBook -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" AutoFillMiscellaneousForms -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" AutoFillPasswords -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" IncludeDebugMenu 1
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" LastDisplayedWelcomePageVersionString -string 4.0
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" NewWindowBehaviour 0
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" RestoreSessionAtLaunch -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" WebKitJavaScriptCanOpenWindowsAutomatically -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" ShowStatusBar -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" HomePage "http://intranet.rdigest.com"
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.internetconfigpriv" WWWHomePage "http://intranet.rdigest.com"
        #+ com.apple.SetupAssistant.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.SetupAssistant" DidSeeCloudSetup -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.SetupAssistant" GestureMovieSeen none
        #+ com.apple.sidebarlists.plist (ugly but too complex for defaults or plistbuddy and I'm lazy)
        sudo /bin/cp -f "/var/root/com.apple.sidebarlists.plist" "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist"
        #+ com.apple.systempreferences.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preference.startupdisk" "com.apple.prefs.backup" "com.apple.preferences.softwareupdate" "com.apple.preferences.parentalcontrols" "com.apple.preference.internet" "com.apple.preferences.internetaccounts" "com.apple.preferences.icloud" "com.apple.preferences.sharing" "com.apple.preference.desktopscreeneffect" "com.apple.preference.security" "com.apple.preference.engerysaver"
        #+ com.apple.symbolichotkeys.plist (Disable Dashboard and Mission Control Keys so they are default Fn keys)
        sudo $PB -c "Add :AppleSymbolicHotKeys:32:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:32:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:33:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:33:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:34:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:34:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:35:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:35:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:36:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:36:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:37:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:37:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:52:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:52:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:59:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:59:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:62:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:62:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:63:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:63:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:64:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:64:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:65:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:65:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Add :AppleSymbolicHotKeys:73:enabled bool NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        sudo $PB -c "Set :AppleSymbolicHotKeys:73:enabled NO" /System/Library/User\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.symbolichotkeys.plist
        #+ com.apple.TextEdit.plist
        #+ NOTE : Changed my mind, not touching this stuff yet
        #sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.TextEdit" ApplePersistenceIgnoreState YES
        #sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.TextEdit" NSQuitAlwaysKeepsWindows -int 0
        #+ com.apple.TimeMachine.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.TimeMachine" DoNotOfferNewDisksForBackup -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.TimeMachine" AutoBackup -bool NO
        #+ com.apple.universalaccess.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.universalaccess" voiceOverOnOffKey -bool NO
        #+ .GlobalPreferences
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" AppleKeyboardUIMode -int 2
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" AppleMiniaturizeOnDoubleClick -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" AppleShowAllExtensions -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" AppleShowScrollBars -string "Always"
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" NSAutomaticSpellingCorrectionEnabled -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" NSAutomaticWindowAnimationsEnabled -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" NSNavPanelExpandedStateForSaveMode -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" NSQuitAlwaysKeepsWindows -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" PMPrintingExpandedStateForPrint -bool YES
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" com.apple.swipescrolldirection -bool NO
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/.GlobalPreferences" com.apple.keyboard.fnState -bool YES
       fi
      done
      
      #* Create LOCAL ADMIN ACCOUNT.
      #+ Note : Redirecting home directory to /var so regular end users don't see the local admin home directory at all.
      #+ Note : Consider UniqueID in regard to the Hide500Users value for /Library/Preferences/com.apple.loginwindow
      #+ Note : kcpassword cannot be scripted, you must supply it.
      #+ Note : You may want to consider creating more than one local ADMIN account. For example, one full admin and one with ARD permissions.
      #+ Note : The password is set via plain text, you could supply a pre-made hash file to be more secure. Each user has their own shadow file, with each shadow file stored under a .plist file located in /var/db/dslocal/nodes/Default/users/. The associated hash contains the users GUID which can be found by running dscl localhost -read /Search/Users/ | grep GeneratedUID | cut -c15-
      
      #+ Create the user.
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME}
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME} UserShell /bin/bash
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME} RealName "${SHORTNAME}"
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME} UniqueID "${UNIQUEID}"
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME} PrimaryGroupID 80
      sudo /usr/bin/dscl . -create /Users/${SHORTNAME} NFSHomeDirectory "/var/${SHORTNAME}"
      sudo /usr/bin/dscl . -passwd /Users/${SHORTNAME} "${PASSWORD}"
      sudo /usr/bin/dscl . -append /Groups/admin GroupMembership "${SHORTNAME}"
      sudo /bin/cp -Rfv /System/Library/User\ Template/English.lproj "/var/${SHORTNAME}"
      #+ Permissions.
      sudo /usr/sbin/chown -R ${SHORTNAME}:admin "/var/${SHORTNAME}"
      #+ Hide the user from the loginwindow.
      sudo /usr/bin/defaults write "/Library/Preferences/com.apple.loginwindow" HiddenUsersList -array-add ${SHORTNAME}
      
      #* Enable autoLoginUser for this user so "boot" phase is seamless.
      sudo /usr/bin/defaults write "/Library/Preferences/com.apple.loginwindow" autoLoginUser -string "${SHORTNAME}"
      #+ kcpassword payload
      sudo /bin/cp -f "/var/root/kcpassword" "/etc/kcpassword"
      sudo /bin/rm -Rf "/etc/kcpassword.disabled"
      #+ kcpassword special permissions.
      sudo /usr/sbin/chown root:wheel "/etc/kcpassword"
      sudo /bin/chmod 600 "/etc/kcpassword"
      
      #* VNC password
      ENCVNCPASSWD=$(/bin/echo "${PASSWORD}" | perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8}).*/$1/; @p = unpack "C*", $_; foreach (@k) { printf "%02X", $_ ^ (shift @p || 0) }; print "\n"')
      sudo /bin/echo "${ENCVNCPASSWD}" > "/Library/Preferences/com.apple.VNCSettings.txt"
      #+ com.apple.VNCSettings.txt special permissions.
      sudo /usr/sbin/chown -R root:wheel "/Library/Preferences/com.apple.VNCSettings.txt"
      sudo /bin/chmod -R 600 "/Library/Preferences/com.apple.VNCSettings.txt"
      
      #* Enable SSH
      sudo /usr/bin/defaults delete "/System/Library/LaunchDaemons/ssh" "Disabled"
      #+ SSH daemon special permissions.
      sudo /usr/sbin/chown root:wheel "/System/Library/LaunchDaemons/ssh.plist"
      sudo /bin/chmod 644 "/System/Library/LaunchDaemons/ssh.plist"
      #+ SSH MOTD banner.
      sudo /bin/echo " " > "/etc/motd"
      sudo /bin/echo "Unauthorized access to these resources is prohibited." >> "/etc/motd"
      sudo /bin/echo " " >> "/etc/motd"
      #+ SSH MOTD special permissions.
      sudo /bin/chmod 755 "/etc/motd"
      sudo /usr/sbin/chown root:wheel "/etc/motd"
      
      #* Enable Apple Remote Desktop
      #+ Note : Check kickstart options, you can make it more secure by using -allowAccessFor -specifiedUsers
      sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -access -on -privs -all -clientopts -setvnclegacy -vnclegacy yes
      
      #* Disable softwareupdate schedule with a daemon.
      #+ NOTE : softwareupdate plist is machine specific, I do it this way so any future user that logs in has it disabled.
      sudo /usr/bin/defaults write /Library/LaunchDaemons/org.softwareupdate Label org.softwareupdate
      sudo /usr/bin/defaults write /Library/LaunchDaemons/org.softwareupdate LaunchOnlyOnce -bool TRUE
      sudo /usr/bin/defaults write /Library/LaunchDaemons/org.softwareupdate Program "/usr/sbin/softwareupdate"
      sudo /usr/bin/defaults write /Library/LaunchDaemons/org.softwareupdate RunAtLoad -bool TRUE
      sudo /usr/bin/defaults write /Library/LaunchDaemons/org.softwareupdate ProgramArguments -array "/usr/sbin/softwareupdate" "--schedule" "off"
      #+ softwareupdate Launch Daemon special permissions.
      sudo /usr/sbin/chown root:wheel "/Library/LaunchDaemons/org.softwareupdate.plist"
      sudo /bin/chmod 644 "/Library/LaunchDaemons/org.softwareupdate.plist"
      
      #* Remove dockfixup, most end users don't require any of the iLife apps for work purposes.
      sudo /bin/mv -f /Library/Preferences/com.apple.dockfixup.plist{,.BACKUP}
      
      #* Disable /Library/Printers/PPDs
      #+ NOTE : This is a legacy setting I used to do as Quark populates its print dialog with every PPD. Will go away soon.
      sudo /bin/cp -R /Library/Printers/PPDs/Contents/Resources /Library/PrintersPPDsDisabled
      sudo /bin/rm -R /Library/Printers/PPDs/Contents/Resources/*.*
      
      #* Disable /System/Library/Printers/PPDs
      #+ NOTE : This is a legacy setting I used to do as Quark populates its print dialog with every PPD. Will go away soon.
      sudo /bin/cp -R /System/Library/Printers/PPDs/Contents/Resources /System/Library/PrintersPPDsDisabled
      sudo /bin/rm -R /System/Library/Printers/PPDs/Contents/Resources/*.*
      
      #* Enable Access for Assistive Devices.
      #+ NOTE : Enabling this for applescripts that need to manipulate the GUI.
      sudo touch /private/var/db/.AccessibilityAPIEnabled
      
      #* Link to Directory Utility.
      #+ NOTE : Because its more convenient than 5 clicks!
      sudo /bin/ln -s "/System/Library/CoreServices/Directory Utility.app" "/Applications/Utilities/Directory Utility.app"
      
      #* Turn down default volume
      #+ NOTE : So the "boot" phase doesn't surprise anyone :)
      sudo /usr/bin/osascript -e "set Volume 2"
      
      #* Disable QuickLook Daemon
      #+ Rather than constantly clearing /Users/USER/Library/Caches/com.apple.QuickLookDaemon
      /usr/bin/defaults write "/System/Library/LaunchAgents/com.apple.quicklook" Disabled -bool true
      
      #* Remove Alex and save 450mb, smaller DMG size.
      sudo /bin/rm -Rf "/System/Library/Speech/Voices/Alex.SpeechVoice"
      
      #* Remove any sleepimage, smaller DMG size.
      #+ NOTE : Only do this if you understand what its doing. Google it.
      sudo /bin/rm -Rf "/private/var/vm/sleepimage"
      
      #* Remove any swapfile, smaller DMG size.
      sudo /bin/rm -Rf "/private/var/vm/swapfile0"
      
      #* Remove caches just-in-case there is anything machine specific.
      sudo /bin/rm -Rf ~/Library/Caches/*
      sudo /bin/rm -Rf /Library/Caches/*
      sudo /bin/rm -Rf /System/Library/Caches/*
      
      #* Remove preferences just-in-case there is anything machine specific.
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
      sudo /bin/rm -Rf /Library/Preferences/SystemConfiguration/preferences.plist
      
      #* Set "boot" phase LoginHook.
      #+ Use to run scripts that cannot be added to the "build" phase.
      sudo /usr/bin/defaults write "/var/root/Library/Preferences/com.apple.loginwindow" LoginHook -string "/var/root/boot.sh"
      
      
    • boot.sh
      #* boot.sh
      #+ Phase 2 of 3
      #+ This script runs as a LoginHook to prep a Mac OS X 10.7.3 prior to the localise phase.
      
      #* PLIST BUDDY
      PB="/usr/libexec/PlistBuddy"
      
      #* Serial number.
      SERIAL=$(/usr/sbin/ioreg -c IOPlatformExpertDevice | /usr/bin/sed -E -n -e '/IOPlatformSerialNumber/{s/^.*[[:space:]]"IOPlatformSerialNumber" = "(.+)"$/\1/p;q;}')
      
      #* Mac address.
      MACADDRESS=$(/usr/sbin/networksetup -getMACADDRESS en0 | /usr/bin/awk '{print $3}' | /usr/bin/sed s/://g)
      
      #* Model.
      MODEL=$(sudo /usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/grep -E model | /usr/bin/awk '{print $3}' | /usr/bin/sed 's/\<\"//' | sed 's/\"\>//')
      
      #* Set Computer name,Local Host Name, Hostname, Netbios name.
      #+ NOTE : I do this so the machine is easily identifiable during first boot via Apple Remote Desktop Administrator client. I support sites remotely.
      sudo /usr/sbin/scutil --set ComputerName "${SERIAL}-${MACADDRESS}"
      sudo /usr/sbin/scutil --set LocalHostName "${SERIAL}-${MACADDRESS}"
      sudo /usr/sbin/scutil --set HostName "${SERIAL}-${MACADDRESS}"
      sudo /bin/hostname "${SERIAL}-${MACADDRESS}"
      sudo /usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName "${SERIAL}"
      
      #* Set info2 field in ARD.
      #+ NOTE : I do this simply so I can quickly see machine models via ARD (so I know which macs can/can't be upgraded to the latest OS. I don't buy upgrades, I simply create images for the OS that the mac ships with.
      sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -computerinfo -set2 -2 "${MODEL}"
      
      #* Set Computer sleep idle time, Display sleep idle time, Disable hard disk sleep.
      #+ NOTE : So the hard disk doesn't go to sleep on me while supporting remotely.
      sudo /usr/sbin/systemsetup -setcomputersleep "60"
      sudo /usr/sbin/systemsetup -setdisplaysleep "15"
      sudo /usr/sbin/systemsetup -setharddisksleep off
      
      #* Disable ipv6.
      #+ NOTE : Issues have been reported regarding Binding to AD if IPv6 is enabled so I turn it off. (don't use IPv6 yet anyway)
      sudo /usr/sbin/networksetup -setv6off "Airport"
      sudo /usr/sbin/networksetup -setv6off "Bluetooth Dun"
      sudo /usr/sbin/networksetup -setv6off "Bluetooth Pan"
      sudo /usr/sbin/networksetup -setv6off "Ethernet"
      sudo /usr/sbin/networksetup -setv6off "FireWire"
      sudo /usr/sbin/networksetup -setv6off "Wi-Fi"
      
      #* Order Services.
      #+ NOTE : Issues have been reported with certain VPN profile setups if services don't have priority. Won't explain here, too detailed. Email me if you want details.
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Wi-Fi" "FireWire"
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Wi-Fi" "FireWire" "Bluetooth DUN"
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Wi-Fi" "FireWire" "Bluetooth DUN" "Bluetooth PAN"
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Airport" "FireWire"
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Airport" "FireWire" "Bluetooth DUN"
      sudo /usr/sbin/networksetup -ordernetworkservices "Ethernet" "Airport" "FireWire" "Bluetooth DUN" "Bluetooth PAN"
      
      #* Disable Un-necessary network services.
      sudo sudo /usr/sbin/networksetup -setnetworkserviceenabled "Bluetooth DUN" "off"
      sudo sudo /usr/sbin/networksetup -setnetworkserviceenabled "Bluetooth PAN" "off"
      sudo /usr/sbin/networksetup -setnetworkserviceenabled "FireWire" "off"
      
      #* Disable Airport Power
      #+ NOTE : Mainly to reduce LAN noise. You could limit this to non-laptops.
      sudo /usr/sbin/networksetup -setairportpower "en1" "off"
      
      #* Default preferences.
      #+ Modifies /System/Library/User Template
      #+ Note : Must do during first boot as plist files contain UUID or MACADDRESS
      #+ Note : At some point Apple changed certain modesl from using MACADDRESS and instead now use UUID. I can't be bothered figuring it out so just writing one of each.
      for USER_TEMPLATE in `sudo ls /System/Library/User\ Template`
      do
       if [ -r "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences" ]; then
        /bin/echo "Modifying /System/Library/User Template/${USER_TEMPLATE}/Library/Preferences"
        # Ensure ByHost is there
        sudo /bin/mkdir -p "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost"
        # com.apple.screensaver.plist
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.screensaver" askForPassword -int 1
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.screensaver" askForPasswordDelay -int 5
        # com.apple.screensaver.UUID.plist
        sudo $PB -c 'Add :CleanExit string YES' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :idleTime integer 900' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :moduleDict dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :moduleDict:iLifeMediaGroupType integer 0' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :moduleDict:moduleName string ${YOURSCREENSAVER}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :moduleDict:path string /Library/Screen\ Savers/${YOURSCREENSAVER}.slideSaver' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        sudo $PB -c 'Add :moduleDict:type integer 4' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${UUID}.plist"
        # com.apple.screensaver.MACADDRESS.plist
        sudo $PB -c 'Add :CleanExit string YES' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :idleTime integer 900' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :moduleDict dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :moduleDict:iLifeMediaGroupType integer 0' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :moduleDict:moduleName string ${YOURSCREENSAVER}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :moduleDict:path string /Library/Screen\ Savers/${YOURSCREENSAVER}.slideSaver' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        sudo $PB -c 'Add :moduleDict:type integer 4' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.screensaver.${MACADDRESS}.plist"
        # Laptop?
        ioreg -rd1 -c IOPlatformExpertDevice | grep -E model | awk '{print $3}' | sed s/\<\"// | sed s/\"\>// | grep iMac
        if [ "$?" == "1" ]; then
         # com.apple.systemuiserver.plist for laptop
         sudo $PB -c 'Delete menuExtras' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist" 
         sudo $PB -c 'Add menuExtras array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist" 
         sudo $PB -c 'Add menuExtras:0 string /Applications/Utilities/Keychain\ Access.app/Contents/Resources/Keychain.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:1 string /System/Library/CoreServices/Menu\ Extras/AirPort.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:2 string /System/Library/CoreServices/Menu\ Extras/VPN.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:3 string /System/Library/CoreServices/Menu\ Extras/Bluetooth.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:4 string /System/Library/CoreServices/Menu\ Extras/TextInput.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:5 string /System/Library/CoreServices/Menu\ Extras/Volume.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:6 string /System/Library/CoreServices/Menu\ Extras/Displays.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:7 string /System/Library/CoreServices/Menu\ Extras/RemoteDesktop.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:8 string /System/Library/CoreServices/Menu\ Extras/Battery.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         # com.apple.systemuiserver.${UUID}.plist (do not load) for laptop
         sudo $PB -c 'Delete dontAutoLoad' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist" 
         sudo $PB -c 'Add dontAutoLoad array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist" 
         sudo $PB -c 'Add dontAutoLoad:0 string /System/Library/CoreServices/Menu\ Extras/TimeMachine.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist"
         # com.apple.systemuiserver.${MACADDRESS}.plist (do not load) for laptop
         sudo $PB -c 'Delete dontAutoLoad' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist" 
         sudo $PB -c 'Add dontAutoLoad array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist" 
         sudo $PB -c 'Add dontAutoLoad:0 string /System/Library/CoreServices/Menu\ Extras/TimeMachine.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist"
        else
         # com.apple.systemuiserver.plist for non-laptop
         sudo $PB -c 'Add menuExtras array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist" 
         sudo $PB -c 'Add menuExtras:0 string /Applications/Utilities/Keychain\ Access.app/Contents/Resources/Keychain.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:1 string /System/Library/CoreServices/Menu\ Extras/Bluetooth.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:2 string /System/Library/CoreServices/Menu\ Extras/TextInput.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:3 string /System/Library/CoreServices/Menu\ Extras/Volume.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:4 string /System/Library/CoreServices/Menu\ Extras/Displays.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         sudo $PB -c 'Add menuExtras:5 string /System/Library/CoreServices/Menu\ Extras/RemoteDesktop.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.systemuiserver.plist"
         # com.apple.systemuiserver.${UUID}.plist (do not load) for non-laptop
         sudo $PB -c 'Add dontAutoLoad array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist" 
         sudo $PB -c 'Add dontAutoLoad:0 string /System/Library/CoreServices/Menu\ Extras/AirPort.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist"
         sudo $PB -c 'Add dontAutoLoad:1 string /System/Library/CoreServices/Menu\ Extras/VPN.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist"
         sudo $PB -c 'Add dontAutoLoad:2 string /System/Library/CoreServices/Menu\ Extras/TimeMachine.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist"
         sudo $PB -c 'Add dontAutoLoad:3 string /System/Library/CoreServices/Menu\ Extras/Battery.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${UUID}.plist"
         # com.apple.systemuiserver.${MACADDRESS}.plist (do not load) for non-laptop
         sudo $PB -c 'Add dontAutoLoad array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist" 
         sudo $PB -c 'Add dontAutoLoad:0 string /System/Library/CoreServices/Menu\ Extras/AirPort.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist"
         sudo $PB -c 'Add dontAutoLoad:1 string /System/Library/CoreServices/Menu\ Extras/VPN.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist"
         sudo $PB -c 'Add dontAutoLoad:2 string /System/Library/CoreServices/Menu\ Extras/TimeMachine.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist"
         sudo $PB -c 'Add dontAutoLoad:3 string /System/Library/CoreServices/Menu\ Extras/Battery.menu' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/ByHost/com.apple.systemuiserver.${MACADDRESS}.plist"
        fi
       fi
      done
      
      #* Disable "boot" phase LoginHook
      sudo /usr/bin/defaults delete "/var/root/Library/Preferences/com.apple.loginwindow" LoginHook
      
      #* Installing Updates
      #+ NOTE : This is for pkgs that require boot volume
      #+ NOTE : You need to add relevant .pkgs to /var/root/Updates
      find /var/root/Updates -name .DS_Store -exec rm {} \;
      for i in `ls /var/root/Updates`
      do
       /bin/echo "Installing $i"
       sudo installer -pkg /var/root/$i -target /
      done
      
      
    • localise.sh
      #* localise.sh
      #+ Phase 3 of 3
      #+ This script is run manually (I do it with an Applescript GUI wrapper). To be used for localisation as I support multiple sites (languages, locales, timezones etc etc)
      
      #* PLIST BUDDY
      PB="/usr/libexec/PlistBuddy"
      
      #* Apple unique workstation UUID.
      UUID=$(/usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/perl -ne 'if (m/^.*\"IOPlatformUUID\" = \"(.*).*\"$/im) {print $1}')
      
      #* Serial number.
      SERIAL=$(/usr/sbin/ioreg -c IOPlatformExpertDevice | /usr/bin/sed -E -n -e '/IOPlatformSerialNumber/{s/^.*[[:space:]]"IOPlatformSerialNumber" = "(.+)"$/\1/p;q;}')
      
      #* Mac address.
      MACADDRESS=$(/usr/sbin/networksetup -getMACADDRESS en0 | /usr/bin/awk '{print $3}' | /usr/bin/sed s/://g)
      
      # Model.
      MODEL=$(sudo /usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/grep -E model | /usr/bin/awk '{print $3}' | /usr/bin/sed 's/\<\"//' | sed 's/\"\>//')
      
      #* OS
      OS=`/usr/bin/sw_vers | grep ProductVersion | awk '{print $2}'`
      
      #* RAM
      RAM=`/usr/sbin/system_profiler SPHardwareDataType | grep "Memory" | awk '{print $2$3}'`
      
      #* CPU
      CPU=`/usr/sbin/system_profiler SPHardwareDataType | grep "Processor Name" | awk '{print $3$4$5$6$7$8$9}'`
      
      #* Set the workstation ComputerName, LocalHostName,hostname and NetBIOSName
      logger "POSTBUILD PHASE : ComputerName ${ComputerName}"
      sudo /usr/sbin/scutil --set ComputerName "${ComputerName}"
      logger "POSTBUILD PHASE : LocalHostName ${LocalHostName}"
      sudo /usr/sbin/scutil --set LocalHostName "${LocalHostName}"
      logger "POSTBUILD PHASE : hostname ${hostname}"
      sudo /bin/hostname "${hostname}"
      logger "POSTBUILD PHASE : HostName ${HostName}"
      sudo /usr/sbin/scutil --set HostName "${HostName}"
      logger "POSTBUILD PHASE : NetBIOSName ${NetBIOSName}"
      sudo /usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName "${NetBIOSName}"
      
      #* Set the default workstation language
      #+ NOTE : Refer to the xxx.lproj User Template folders as a quick guide (where xxx is the ${language} string). So for english it would be languagesetup -langspec "English" but for Portuguese it would be languagesetup -langspec "pt"
      #+ NOTE : languagesetup zaps /Library/Preferences/.GlobalPreferences so make sure you set the language early ;)
      logger "POSTBUILD PHASE : Language ${language}"
      sudo /usr/sbin/languagesetup -langspec "${language}"
      
      #* Set the default workstation locale
      #+ NOTE : Values consist of Language and Country in the format xx_xx, refer to /usr/share/locale for acceptable values.
      logger "POSTBUILD PHASE : AppleLocale ${locale}"
      sudo /usr/bin/defaults write /Library/Preferences/.GlobalPreferences AppleLocale -string "${locale}"
      
      #* Set the default workstation country
      #+ NOTE : Refer to /usr/share/locale for acceptable values.
      logger "POSTBUILD PHASE : Country ${country}"
      sudo /usr/bin/defaults write /Library/Preferences/.GlobalPreferences Country -string "${country}"
      
      #* Set the default workstation measurement units
      #+ NOTE : Metric is either TRUE or FALSE and Measurement Units is either Inches or Centimeters.
      logger "POSTBUILD PHASE : AppleMeasurementUnits ${applemeasurementunits}"
      sudo /usr/bin/defaults write /Library/Preferences/.GlobalPreferences AppleMeasurementUnits -string "${applemeasurementunits}"
      logger "POSTBUILD PHASE : AppleMetricUnits ${applemetricunits}"
      sudo /usr/bin/defaults write /Library/Preferences/.GlobalPreferences AppleMetricUnits -string "${applemetricunits}"
      
      #* Set default workstation "System" Input Keyboard Layout
      #+ NOTE : The permissions are important otherwise it won't work. I haven't found a reliable source of values anywhere, had to do this manually for each location to capture the values the first time.
      logger "POSTBUILD PHASE - Input Keyboard Layout id : ${keyboardlayoutid}"
      logger "POSTBUILD PHASE - Input Keyboard Layout name : ${keyboardlayoutname}"
      sudo $PB -c "Add :AppleCurrentKeyboardLayoutInputSourceID string com.apple.keylayout.${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleCurrentKeyboardLayoutInputSourceID com.apple.keylayout.${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Delete :AppleDefaultAsciiInputSource" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleDefaultAsciiInputSource:InputSourceKind string Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleDefaultAsciiInputSource:InputSourceKind Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleDefaultAsciiInputSource:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleDefaultAsciiInputSource:KeyboardLayout\ ID ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleDefaultAsciiInputSource:KeyboardLayout\ Name string ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleDefaultAsciiInputSource:KeyboardLayout\ Name ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Delete :AppleEnabledInputSources" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleEnabledInputSources:0 dict" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleEnabledInputSources:0:InputSourceKind string Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleEnabledInputSources:0:InputSourceKind Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleEnabledInputSources:0:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleEnabledInputSources:0:KeyboardLayout\ ID ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleEnabledInputSources:0:KeyboardLayout\ Name string ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleEnabledInputSources:0:KeyboardLayout\ Name ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Delete :AppleSelectedInputSources" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleSelectedInputSources:0 dict" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleSelectedInputSources:0:InputSourceKind string Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleSelectedInputSources:0:InputSourceKind Keyboard\ Layout" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleSelectedInputSources:0:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleSelectedInputSources:0:KeyboardLayout\ ID ${keyboardlayoutid}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Add :AppleSelectedInputSources:0:KeyboardLayout\ Name string ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo $PB -c "Set :AppleSelectedInputSources:0:KeyboardLayout\ Name ${keyboardlayoutname}" "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo chown root:admin "/Library/Preferences/com.apple.HIToolbox.plist"
      sudo chmod 644 "/Library/Preferences/com.apple.HIToolbox.plist"
      
      #* Set default workstation "LoginWindow" Input Keyboard Layout
      #+ NOTE : The permissions are important otherwise it won't work. 
      logger "POSTBUILD PHASE - Loginwindow Keyboard Layout id : ${keyboardlayoutid}"
      logger "POSTBUILD PHASE - Loginwindow Keyboard Layout name : ${keyboardlayoutname}"
      sudo $PB -c "Add :AppleCurrentKeyboardLayoutInputSourceID string com.apple.keylayout.${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :AppleCurrentKeyboardLayoutInputSourceID com.apple.keylayout.${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox dict" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Delete :com.apple.HIToolbox:AppleDefaultAsciiInputSource" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleDefaultAsciiInputSource array" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleDefaultAsciiInputSource:InputSourceKind string Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleDefaultAsciiInputSource:InputSourceKind Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleDefaultAsciiInputSource:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleDefaultAsciiInputSource:KeyboardLayout\ ID ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleDefaultAsciiInputSource:KeyboardLayout\ Name string ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleDefaultAsciiInputSource:KeyboardLayout\ Name ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Delete :com.apple.HIToolbox:AppleEnabledInputSources" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleEnabledInputSources array" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleEnabledInputSources:0 dict" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleEnabledInputSources:0:InputSourceKind string Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleEnabledInputSources:0:InputSourceKind Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleEnabledInputSources:0:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleEnabledInputSources:0:KeyboardLayout\ ID ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleEnabledInputSources:0:KeyboardLayout\ Name string ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleEnabledInputSources:0:KeyboardLayout\ Name ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Delete :com.apple.HIToolbox:AppleSelectedInputSources" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleSelectedInputSources array" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleSelectedInputSources:0 dict" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleSelectedInputSources:0:InputSourceKind string Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleSelectedInputSources:0:InputSourceKind Keyboard\ Layout" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleSelectedInputSources:0:KeyboardLayout\ ID integer ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleSelectedInputSources:0:KeyboardLayout\ ID ${keyboardlayoutid}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Add :com.apple.HIToolbox:AppleSelectedInputSources:0:KeyboardLayout\ Name string ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo $PB -c "Set :com.apple.HIToolbox:AppleSelectedInputSources:0:KeyboardLayout\ Name ${keyboardlayoutname}" "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      # Special Explicit Permissions!!!
      sudo chown securityagent:wheel "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      sudo chmod 644 "/var/tmp/com.apple.HIToolbox.loginwindow.plist"
      
      #* Set Visibility Input Keyboard Layout Menu in Loginwindow
      logger "POSTBUILD PHASE - Loginwindow : showInputMenu"
      sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool "TRUE"
      logger "POSTBUILD PHASE - Loginwindow : ModeNameVisible"
      sudo defaults write /var/ard/Library/Preferences/com.apple.menuextra.textinput ModeNameVisible -bool "TRUE"
      sudo chmod 777 /Library/Preferences/com.apple.loginwindow.plist
      
      #* Set default workstation network time server
      logger "POSTBUILD PHASE : setnetworktimeserver ${timeserver}"
      sudo /usr/sbin/systemsetup -setusingnetworktime "on"
      sudo /usr/sbin/systemsetup -setnetworktimeserver "${networktimeserver}"
      
      #* Set default workstation timezone
      #+ NOTE : Refer to /usr/sbin/systemsetup -listtimezones for acceptable values.
      logger "POSTBUILD PHASE : settimezone ${timezone}"
      sudo /usr/sbin/systemsetup -settimezone "${timezone}"
      
      #* Energy Saver Defaults
      logger "POSTBUILD PHASE : /Library/Preferences/com.apple.PowerManagement"
      sudo /usr/sbin/systemsetup -setallowpowerbuttontosleepcomputer "off"
      sudo /usr/sbin/systemsetup -setcomputersleep "60"
      sudo /usr/sbin/systemsetup -setdisplaysleep "45"
      sudo /usr/sbin/systemsetup -setharddisksleep "off"
      sudo /usr/sbin/systemsetup -setrestartpowerfailure "off"
      sudo /usr/sbin/systemsetup -setwakeonnetworkaccess "on"
      
      #* Modify authorizations
      #+ NOTE : if you don't know what this is you probably shouldn't mess with it ;) email me and I'll explain chris.gerke@gmail.com
      
      #+ Backup Original
      logger "POSTBUILD PHASE : /etc/authorization"
      sudo /bin/cp -f /etc/authorization{,.original}
      #+ Allow date & time preference pane access.
      sudo $PB -c "set rights:system.preferences.datetime:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.datetime:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.datetime:group" "/etc/authorization"
      #+ Allow DVD region setting rights
      sudo $PB -c "add rights:system.device.dvd.setregion.change dict" "/etc/authorization"
      sudo $PB -c "add rights:system.device.dvd.setregion.change:class string" "/etc/authorization"
      sudo $PB -c "set rights:system.device.dvd.setregion.change:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.device.dvd.setregion.change:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.device.dvd.setregion.change:group" "/etc/authorization"
      #+ Allow DVD region initial setting rights
      sudo $PB -c "set rights:system.device.dvd.setregion.initial:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.device.dvd.setregion.initial:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.device.dvd.setregion.initial:group" "/etc/authorization"
      #+ Allow network preference pane access
      sudo $PB -c "set rights:system.preferences.network:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.network:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.network:group" "/etc/authorization"
      #+ Change /etc/authorization to allow all users to open preference panes
      sudo $PB -c "set rights:system.preferences.printing:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.printing:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences.printing:group" "/etc/authorization"
      #+ Allow preference panes
      sudo $PB -c "set rights:system.preferences:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences:shared" "/etc/authorization"
      sudo $PB -c "delete rights:system.preferences:group" "/etc/authorization"
      #+ Allow print admin rights
      sudo $PB -c "set rights:system.print.admin:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.print.admin:group" "/etc/authorization"
      sudo $PB -c "delete rights:system.print.admin:shared" "/etc/authorization"
      #+ Allow printing manager rights
      sudo $PB -c "set rights:system.printingmanager:class allow" "/etc/authorization"
      sudo $PB -c "delete rights:system.printingmanager:rule" "/etc/authorization"
      #+ Permissions
      sudo chown root:wheel "/etc/authorization"
      sudo chmod 644 "/etc/authorization"
      
      #* Require admin password for comp-to-comp wifi
      logger "POSTBUILD PHASE : RequireAdminIBSS"
      sudo /usr/libexec/airportd en1 prefs RequireAdminIBSS=YES
      
      #* Disable font protection because designers persist in using PS versions of system dfonts so we have to cusotmise it later!! arrgghhhh
      logger "POSTBUILD PHASE : fontprotection -off"
      sudo /usr/bin/atsutil fontprotection -off
      
      #* Set default font server
      logger "POSTBUILD PHASE : Setting ${fontserver}"
      sudo echo "server.address=${fontserver}" > "/Library/Preferences/com.extensis.UniversalTypeClient.conf"
      sudo echo "server.port=${fontport}" >> "/Library/Preferences/com.extensis.UniversalTypeClient.conf"
      
      #* Default preferences.
      #+ Modifies /System/Library/User Template
      #+ I do it here because each site has a custom intranet page, for security reasons not adding the extra bits that set DNS but you get the idea....
      for USER_TEMPLATE in `sudo ls /System/Library/User\ Template`
      do
       if [ -r "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences" ]; then
        /bin/echo "Modifying /System/Library/User Template/${USER_TEMPLATE}/Library/Preferences"
        # Safari
        logger "POSTBUILD PHASE : Homepage $url"
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.internetconfigpriv" WWWHomePage $url
        sudo /usr/bin/defaults write "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.Safari" HomePage $url
       fi  
      done
      
      #* Setup the Login Window, add a banner.
      logger "POSTBUILD PHASE : Loginwindow"
      sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText -string "$LoginWindowText"
      #+ Username and Password fields instead of user badges
      sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool "TRUE"
      #+ Show host info
      sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo "DSStatus"
      #+ Hide the < UniqueID 500 users.
      sudo defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool TRUE
      #+ Prevent "Other" from appearing in the loginwindow.
      sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
      #+ Add a delay to avoid authentication issues on machines with slow DCHP leases
      sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow StartupDelay -int 13
      
      #* Bind to AD.
      #+ NOTE : This is done with ADMItMac, will be testing feasability of using built-in AD in the coming days, will post and update.
      logger "POSTBUILD PHASE : ADMitMac Attempting bind to ${OU}"
      sudo /sbin/amconfig -A -F -c ${hostname}
      logger "POSTBUILD PHASE : ADMitMac Changing User Attribute RecordName to sAMAccountName (shortname for user directory)"
      sudo $PB -c "Set :Record\ Type\ Map:dsRecTypeStandard\:Users:Attribute\ Type\ Map:dsAttrTypeStandard\:RecordName:AD\ Attributes:0 sAMAccountName" /Library/DirectoryServices/Plugins/CIFSPlugin.dsplug/Contents/Resources/LDAPConfig.plist
      sudo $PB -c "Set :Record\ Type\ Map:dsRecTypeStandard\:Users:Attribute\ Type\ Map:dsAttrTypeStandard\:RecordName:AD\ Attributes:2 userPrincipalName" /Library/DirectoryServices/Plugins/CIFSPlugin.dsplug/Contents/Resources/LDAPConfig.plist
      logger "POSTBUILD PHASE : ADMitMac Display Cached Creds Dialog false"
      sudo /usr/bin/defaults write /Library/Preferences/com.thursby.tss_check_cifs "Display Cached Creds Dialog" "false"
      sudo /usr/bin/defaults write /Library/Preferences/com.thursby.CIFSPlugin "LDAP Connect Timeout" 30
      
      #* Set NIC speed for regions that may want hard setting
      logger "POSTBUILD PHASE : NIC Speed"
      sudo /usr/sbin/networksetup -setMedia en0 ${networkspeed} ${networkduplex}
      
      #* Set LoginHook
      logger "POSTBUILD PHASE : LoginHook"
      sudo /usr/bin/defaults write "/var/root/Library/Preferences/com.apple.loginwindow" LoginHook -string "${GlobalLoginHook}"
      
      #* Disable autologin
      sudo /bin/rm -f /var/ard/Library/Keychains/login.keychain
      sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser ""
      
      #* Repair Permissions (can't run in single user mode)
      sudo /usr/sbin/diskutil repairPermissions /
      
      #* Email workstation details to me, this is a perl script using smtp. Will add a copy in another post.
      sudo /var/root/email.sh
      


That’s all folks.

Probably not…. anyone that makes SOEs knows it never ever ends ;)

Will post any additions I make, the most important part now is test test test.

Filter OSX netboot images by Mac model

Posted 2012/08/14 By mikep345678

From a post on DeployStudio’s forum. It’s not currently live so this is from Google’s cache…

Model Property filtering..How to set in runtime.nbi for multiple macs?

I was able to use System Imaging Utility to create a NBI that had the plist with the Model Property Filtering in it. I then copied the Model Property Filtering plist information into the NBImageInfo.plist in the NBI and the options became available in Server Admin.

I set my 10.5 PPC NBI to not allow G3’s in Server Admin and from what I can tell imaging three G3 machines so far it appears to have worked to keep them from that PPC NBI and let the NBI I made for my G3’s which points to my server hosting DS rc120 pick things up.

Here’s a copy of the text from the NBImageInfo.plist made from System Image Utility:

<?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>Architectures</key>
<array>
<string>i386</string>
</array>
<key>BackwardCompatible</key>
<false/>
<key>BootFile</key>
<string>booter</string>
<key>Description</key>
<string>NetBoot of Mac OS X Server 10.6 (10A433) Install.</string>
<key>DisabledSystemIdentifiers</key>
<array>
<string>MacBookPro5,2</string>
<string>MacBookPro5,1</string>
<string>MacBookPro5,5</string>
<string>MacBookPro5,4</string>
<string>MacBookPro5,3</string>
<string>PowerBook5,9</string>
<string>PowerBook3,4</string>
<string>PowerBook6,4</string>
<string>PowerBook5,7</string>
<string>PowerBook3,2</string>
<string>PowerBook6,2</string>
<string>PowerBook5,5</string>
<string>PowerBook5,3</string>
<string>PowerBook5,1</string>
<string>PowerBook3,5</string>
<string>PowerBook5,8</string>
<string>PowerBook3,3</string>
<string>PowerBook5,6</string>
<string>PowerBook3,1</string>
<string>PowerBook6,1</string>
<string>PowerBook5,4</string>
<string>PowerBook5,2</string>
<string>PowerBook6,8</string>
<string>MacBook5,2</string>
<string>MacBook6,1</string>
<string>PowerMac3,3</string>
<string>PowerMac3,6</string>
<string>PowerMac3,2</string>
<string>PowerMac3,5</string>
<string>PowerMac3,1</string>
<string>PowerMac3,4</string>
<string>MacBookPro6,1</string>
<string>MacBookPro6,2</string>
<string>PowerMac12,1</string>
<string>PowerMac8,2</string>
<string>PowerMac8,1</string>
<string>MacBookAir2,1</string>
<string>MacBookAir1,1</string>
<string>PowerBook4,1</string>
<string>PowerBook2,3</string>
<string>PowerBook2,1</string>
<string>PowerBook4,4</string>
<string>PowerBook4,2</string>
<string>PowerBook2,2</string>
<string>PowerBook4,3</string>
<string>MacBookPro1,2</string>
<string>MacBookPro1,1</string>
<string>MacBookPro4,1</string>
<string>MacBookPro3,1</string>
<string>MacBookPro2,2</string>
<string>MacBookPro2,1</string>
<string>iMac10,1</string>
<string>MacPro1,1</string>
<string>MacPro3,1</string>
<string>MacPro1,1,Quad</string>
<string>MacPro2,1</string>
<string>PowerMac6,3</string>
<string>PowerMac4,2</string>
<string>PowerMac4,5</string>
<string>PowerMac6,1</string>
<string>MacBook1,1</string>
<string>iMac7,1</string>
<string>iMac8,1</string>
<string>iMac9,1</string>
<string>Xserve2,1</string>
<string>PowerBook1,1</string>
<string>MacBookPro7,1</string>
<string>MacBook5,1</string>
<string>PowerMac2,2</string>
<string>PowerMac2,1</string>
<string>PowerMac4,1</string>
<string>RackMac1,1</string>
<string>RackMac1,2</string>
<string>MacBook7,1</string>
<string>PowerMac10,2</string>
<string>PowerMac10,1</string>
<string>MacBook3,1</string>
<string>MacBook4,1</string>
<string>MacBook2,1</string>
<string>PowerMac5,2</string>
<string>PowerMac5,1</string>
<string>Macmini2,1</string>
<string>Macmini3,1</string>
<string>Macmini1,1</string>
<string>iMac4,2</string>
<string>iMac4,1</string>
<string>Xserve1,1</string>
<string>RackMac3,1</string>
<string>iMac11,1</string>
<string>PowerMac9,1</string>
<string>PowerMac11,2,Quad</string>
<string>PowerMac7,3</string>
<string>PowerMac11,2</string>
<string>PowerMac7,2</string>
<string>PowerMac6,4</string>
<string>PowerMac4,4</string>
<string>iMac5,2</string>
<string>iMac5,1</string>
<string>iMac6,1</string>
<string>PowerBook6,7</string>
<string>PowerBook6,5</string>
<string>PowerBook6,3</string>
<string>Xserve3,1</string>
<string>PowerMac1,2</string>
<string>PowerMac1,1</string>
<string>MacPro4,1</string>
</array>
<key>EnabledSystemIdentifiers</key>
<array/>
<key>Index</key>
<integer>1632</integer>
<key>IsDefault</key>
<false/>
<key>IsEnabled</key>
<false/>
<key>IsInstall</key>
<false/>
<key>Kind</key>
<integer>2</integer>
<key>Language</key>
<string>Default</string>
<key>Name</key>
<string>NetBoot of Mac OS 10.6 Server Install Disc</string>
<key>RootPath</key>
<string>NetBoot.dmg</string>
<key>SupportsDiskless</key>
<false/>
<key>Type</key>
<string>NFS</string>
<key>osVersion</key>
<string>10.6</string>
</dict>
</plist>

Remove iWork ’09 via script

Posted 2012/08/13 By mikep345678

Found an applescript written by Yvan KOENIG to remove iWork ’09 from a machine. Have converted it to bash so it can more easily be deployed via ARD and as a pre-flight to the installation package in munki.

#!/bin/sh

rm -rf "/Library/com.apple.iWork09.Installer.plist"
rm -rf "/Library/com.apple.iWork09.plist"
rm -rf "/Library/Application Support/iWork '09/"
rm -rf "/Library/Receipts/iWork09Trial.pkg"
rm -rf "/Library/Documentation/Help/iWorkFunctionsHelp.help"
rm -rf "/Applications/iWork '09/"
rm -rf "/Applications/Keynote.app "
rm -rf "/Applications/Numbers.app "
rm -rf "/Applications/Pages.app "

defaultprofile="/System/Library/User Template/English.lproj"

rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Fonts"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Keynote"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Numbers"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Pages"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Keynote.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Numbers.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Pages.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Keynote.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Numbers.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Pages.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Applications/iWork '09/"
rm -rf "$defaultprofile""/Applications/Keynote.app"
rm -rf "$defaultprofile""/Applications/Numbers.app"
rm -rf "$defaultprofile""/Applications/Pages.app"

for userNames in /Users/*
do
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Fonts"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Keynote"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Numbers"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Pages"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Keynote.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Numbers.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Pages.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Keynote.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Numbers.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Pages.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Applications/iWork '09/"
rm -rf "/Users/$userNames/Applications/Keynote.app"
rm -rf "/Users/$userNames/Applications/Numbers.app"
rm -rf "/Users/$userNames/Applications/Pages.app"
done

exit 0

[MACENTERPRISE] Managing Chrome: The Rough Guide

Posted 2012/05/19 By mikep345678

[Editor’s note: This isn’t mine– total props to Nick McSpadden, who posted it to the MacEnterprise mailing list! Thanks, Nick!]

 

Greetings!

This is a sort of follow-up to my guide on managing Firefox, this time focusing on managing Google Chrome.  I’m working on current Chrome version 18 (which just today got updated to 19), and I don’t know for sure how far back this will work, but I think anything higher than v16 properly supports the MCX policies.

The good news about Google Chrome is that it supports MCX!  Unlike Firefox, which requires specific and somewhat obtuse procedures for managing it (including depending upon an add-on that is independently maintained by a hard working individual), the most important parts of Chrome management can be done with already-existing MCX controls.

First let me start off with a link to a very helpful set of information: http://www.chromium.org/administrators
That link covers just about everything you’ll need to know about Chrome policies and management, though some of it is buried.  I discovered (much to my chagrin) that the Chromium site is much more thoroughly documented that Google’s official “Chrome for Administrators” site.

Some important notes about Chrome MCX: all Chrome policies are required to be set to “Always.”  They’re like Profiles from Profile Managers – there’s no middle ground.  Even if you set it to “Once” or “Often,” Chrome will treat the policy as permanent and prevent the user from changing it.  Any policy being managed by MCX in Chrome will be grayed out to user interaction (and there will be a message in the “Options” window about how some settings are being managed by the administrator).  So you’re going to have to “Always” manage these settings whether you like it or not.

The good news is, there’s an alternative, the Master Preferences.  The downside is that the Master Preferences is a “once” option, and doesn’t prevent the user from changing it.  It’s a good way to provide default settings without restricting the users’ ability to personalize it later on.  More on that later.

So, following the Mac Quick Start Guide: (http://www.chromium.org/administrators/mac-quick-start)

1) Inside a fresh copy of Google Chrome is a nice fresh copy of the manifest.  Access it here:
/Applications/Google\ Chrome.app/Contents/Resources/com.google.Chrome.manifest/Contents/Resources/com.google.Chrome.manifest
2) Load this manifest into WGM
3) Here’s the full description of all policies in the Chrome manifest: http://www.chromium.org/administrators/policy-list-3
4) There are some particularly important settings that will be relevant to most.  Here’s what my plist looks like for a lab computer (no individual users):
AutoFillEnabled – False (disables the ability to store autofill information)
BookmarkBarEnabled – True (forces the bookmark bar to show up on all tabs, all the time)
HideWebStorePromo – True (prevents the web store from trying to sell you things, but does not disable the web store)
HomePageIsNewTabPage – False (if you don’t disable this, the homepage will be set to the default Chrome tab page, which opens up the “Most Visited/Apps” switcher)
HomepageLocation – URL (even if you set this, if HomePageIsNewTabPage is set to true, this URL gets ignored)
PasswordManagerEnabled – False (for lab machines, I don’t want them saving passwords, intentionally or accidentally)
RestoreOnStartup – 0 (0 forces it to open the homepage URL on startup)
SyncDisabled – True (same reason as Password Manager – I don’t want these personalized at any time).

That gives you a basic setup for most things you’ll need to worry about.  If you deploy this, you’ll notice a few problems, though.  The first time you launch Chrome, it gives you an undismissable dialogue box asking you if you want to make Chrome the default or submit other info.  That’s bad.  The above manifest also provides no way to control the auto update mechanism, if that’s something you want to do.

This is where the Master Preferences file comes in – http://www.chromium.org/administrators/configuring-other-preferences.  By specifying a Master Preferences file, we can load up default preferences for user accounts *when they are created.*  Note that the Master Preferences file has absolutely no effect on already existing Chrome profiles – only upon new-user generation does Chrome load this file.  It literally copies and pastes the settings in here into the appropriate places in ~/Library/Application Support/Google/Chrome/Default/Preferences.

On Mac OS X, the Master Preferences file must be located at:
/Library/Google/Google Chrome Master Preferences
(yes, really – the file must be named “Google Chrome Master Preferences” with no extension), and must obviously be readable by any user who can launch Chrome (i.e. use 644 permissions).

The Master Preferences file is a JSON file that can contain any of the preferences normally used by Chrome.  If you want the full list of all possible preferences, load up a default Chrome profile and take a look at the Preferences file I mentioned at the path above.  It has everything you’d ever want (and a lot of stuff you probably don’t).  To save you some time, here are some important ones you’ll want to use specifically for deploying Chrome:

{
“homepage_is_newtabpage” : false,
“browser” : {
“show_home_button” : true,
“check_default_browser” : false
},
“bookmark_bar” : {
“show_on_all_tabs” : true
},
“distribution” : {
“skip_first_run_ui” : true,
“show_welcome_page” : false,
“import_bookmarks” : false,
“import_bookmarks_from_file” : “/Library/Google/chrome_bookmarks.html”,
“make_chrome_default” : false
},
“sync_promo” : {
“user_skipped” : true
}
}

The chromium.org page I linked above goes into a bit more detail about this, but I want to give a quick note about the interaction between preferences and MCX.  MCX always wins.  Any policy managed by the MCX and also specified in the Master Prefs will always go the MCX policy.  In the example above, if I had set “homepage_is_newtabpage” to true, it would still be false because MCX sets it to false, and that policy is always enforced.

The really import part is the “distribution” section.  “skip_first_run_ui” will get rid of that annoying dialog box that comes up when you first launch Chrome.  The “import_bookmarks” option asks the user through a UI dialog box if the user wishes to import bookmarks from another browser.  Obviously, we want to suppress that.  There’s an option instead to silently import bookmarks from an HTML file.  You can create this bookmarks HTML file by setting up the bookmarks the way you want, and then Exporting them in the Bookmark Manager.  I place that bookmarks file in /Library/Google/ because it’s already used, but you can put it anywhere.  There is, however, a known bug that has now been assigned a milestone and a solver in Chromium’s bug list – the “import_bookmarks_from_file” is actually ignored if the “skip_first_run_ui” is set to true.  So right now, you can’t silently import your bookmarks in.

The “sync_promo” item doesn’t seem to be necessary if you disable Sync in the MCX settings above, but since MCX policy always wins over Master Prefs, there’s no penalty or downside to including it.

Note that your JSON syntax has to be perfect for this to work.  Any incorrect comma placements, and it simply ignores your master prefs file.  If you find that your Master Prefs isn’t loading up as expected, run Chrome from the Terminal with the debug log turned on to see what’s happening:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome –enable-logging –v=1
This places a file called “chrome_debug.log” in ~/Library/Application Support/Google/Chrome/Default/ (i.e. default user data directory).  The first line will tell you exactly what went wrong with your Master Prefs file.

Now, there’s still one more problem here: new tabs open up to the default Chrome “New Apps / Most Visited” switcher page (called the newtab page).  Unfortunately for us, there’s no way to change this behavior present in the UI.  The good news is, this behavior annoys plenty of other users, and there are a million extensions you can use to get rid of it.  More good news, is that you can silently include extensions in your MCX manifest!

So simply add this to your MCX settings above (forgive the pseudo XML here, just to indicate type of key):
ExtensionInstallForcelist – <array>
dpjamkmjmigaoobjbekmfgabipmfilij;http://clients2.google.com/service/update2/crx – <string>

This silently forces the install of an extension called “Empty New Tab Page,” and specifies an update URL for it (required, since Chrome autoupdates its extensions too if they come from the Chrome Web Store / Extensions pages).  The extension does what you think it does – you get a blank page.  There are other extensions for customizing the new tab pages, or anything else, so as long as you get the extension ID (it’s the long block of letters in the beginning), you can load whatever you want in here.

There you go!  I’ve tested this using Local MCX on my 10.6 and 10.7 machines, and it works perfectly (deployed through Munki as well).  On the whole, Chrome is a bit easier to manage and deploy than Firefox, just because it doesn’t require modifying the app itself to do this.  Also, the Master Preferences file works for any instance of Google Chrome – even if the users install a copy somewhere other than /Applications.  This also does work for Chromium, the open-source version of Chrome.

Hope this helps someone.


Nick McSpadden
nmcspadden@sacredsf.org
Schools of the Sacred Heart

US Code for Copyright & Fair Use:
http://www.law.cornell.edu/uscode/html/uscode17/usc_sec_17_00000107—-000-.html

_____________________________________________________
MacEnterprise, Inc
http://www.macenterprise.org

Advanced Mac Configuration Topics

Posted 2012/04/26 By mikep345678

Found a great resource here; stole the page and put it here. Maybe will be adding to this and making it my Mac Admin knowledge repository…