postflight/firstboot script errors
Hey gang,
Coming along nicely with my scripting and packaging with instaDMG and instaUp2Date, so I'd really like to thank to Walt, Alister, Larkost and the others who've blazed an awesome trail and continue to actively post here. Thanks, y'all.
Where I'm at: after testing each component of my postflight and firstboot scripts on other machines to confirm syntax and proper functioning, I've got everything ACCEPT the PlistBuddy calls working. Can't figure out why so I'm asking for your input here. Also seeing that some but not all of the packages I've got in the instaUp2Date cue are laying down (but I'll save that for another thread).
Here's what I got so far. Perhaps this will be helpful to others in some way. I'm sure I'm missing something silly like a quote or a bracket or something... so you UNIX masters, please do chime in, won't'cha?
Many thanks,
David
[code]#-------------------
# Definitions
#-------------------
# --- services ---
defaults="/usr/bin/defaults"
plist="/usr/libexec/PlistBuddy"
# --- plists ---
labels="com.apple.labels"
finder="com.apple.finder"
sidebar="com.apple.sidebarlists.plist"
getty="edu.getty.firstboot"
# --- directories ---
ROOT="$3/"
PKG_DIR="$1/Contents/Resources"
SCRIPTS_DIR="$3/Library/Scripts/Getty"
LAUNCHD_DIR="$3/Library/LaunchDaemons"
PRIVETC_DIR="$3/private/etc"
PREFS_DIR="$3/Library/Preferences"
USERPREFS_DIR="$3/System/Library/User Template/English.lproj/Library/Preferences"
CURRENT_USER=`ls -l /dev/console | awk '{ print $3 }'`
# --- utilities ---
DYLD="$3/usr/bin/update_dyld_shared_cache"
#-------------------
# Installations
#-------------------
# INITIAL SETUP: creates scripts directory, copy firstboot script there, set launchd properly.
mkdir "${SCRIPTS_DIR}"
cp "${PKG_DIR}/firstboot.sh" "${SCRIPTS_DIR}"
$defaults write "${LAUNCHD_DIR}/${getty}" Label edu.getty.firstboot
$defaults write "${LAUNCHD_DIR}/${getty}" ProgramArguments -array
$plist -c "Add :ProgramArguments:Item\ 1 string /Library/Scripts/Getty/firstboot.sh" "${LAUNCHD_DIR}/${getty}.plist"
$defaults write "${LAUNCHD_DIR}/${getty}" RunAtLoad -bool YES
chown root:wheel "${LAUNCHD_DIR}/${getty}.plist"
chmod 644 "${LAUNCHD_DIR}/${getty}.plist"
#-------------------------------------------------------------------
# Modifications
#
# No users are created, so we can only modify the user template
# for use with all future user accounts created
#-------------------------------------------------------------------
# Update dynamic libraries
$DYLD -universal_boot -root $ROOT
# DESKTOP PREFS: show all media & servers, arranged by "kind"
$defaults write "${USERPREFS_DIR}/${finder}" ShowMountedServersOnDesktop 1
$defaults write "${USERPREFS_DIR}/${finder}" ShowRemovableMediaOnDesktop 1
$defaults write "${USERPREFS_DIR}/${finder}" ShowExternalHardDrivesOnDesktop 1
$defaults write "${USERPREFS_DIR}/${finder}" ShowHardDrivesOnDesktop 1
$plist -c "Set :StandardViewSettings:IconViewSettings:arrangeBy kind" "${USERPREFS_DIR}/${finder}.plist"
# SIDEBAR PREFS: Show all sidebar icons except back to my mac & bonjour
$plist -c "Set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.bonjourEnabled 0" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.backToMyMacEnabled 0" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.connectedEnabled 1" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :systemitems:ShowEjectables 1" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :systemitems:ShowHardDisks 1" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :systemitems:ShowRemovable 1" "${USERPREFS_DIR}/${sidebar}"
$plist -c "Set :systemitems:ShowServers 1" "${USERPREFS_DIR}/${sidebar}"
# LOGIN WINDOW PREFS: show blank username/password fields & custom welcome text
$defaults write "${PREFS_DIR}/com.apple.loginwindow" SHOWFULLNAME -bool YES
$defaults write "${PREFS_DIR}/com.apple.loginwindow" LoginwindowText "Welcome to the J. Paul Getty Network"
# FINDER LABEL PREFS: set to have funny names
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_6 These
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_7 Are
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_5 The
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_2 Colors
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_4 That
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_3 You
$defaults write "${USERPREFS_DIR}/${labels}" Label_Name_1 Crave
# DIALOG BOX PREFS: set "Save as" & "print" boxes to expanded view
$defaults write -g "${USERPREFS_DIR}/${finder}" NSNavPanelExpandedStateForSaveMode -bool YES
$defaults write "${PREFS_DIR}/.GlobalPreferences" PMPrintingExpandedStateForPrint -bool TRUE
# SAFARI PREFS: set homepage and show status bar
$defaults write "${USERPREFS_DIR}/com.apple.Safari" HomePage go/
$defaults write "${USERPREFS_DIR}/com.apple.Safari" ShowStatusBar -bool YES
# NETWORK PREFS: disable .ds-store files on Network Shares
$defaults write "${PREFS_DIR}/com.apple.desktopservices" DSDontWriteNetworkStores true
# MICE PREFS: set Apple Mice to have both right/left buttons
$defaults write "${USERPREFS_DIR}/com.apple.driver.AppleHIDMouse" Button1 -integer 1
$defaults write "${USERPREFS_DIR}/com.apple.driver.AppleHIDMouse" Button2 -integer 2
$defaults write "${USERPREFS_DIR}/com.apple.driver.AppleBluetoothMultitouch.mouse" MouseButtonMode TwoButton
exit 0[/code]