Difference between revisions of "Firstboot Script Commands"
Jump to navigation
Jump to search
(No difference)
|
Revision as of 16:14, 25 August 2010
#!/bin/sh
###
# First Boot script that is used along with a launchd item. Delets both itself and the launchd item after completion.
###
# Define 'kickstart' and'systemsetup' variables, built in OS X script that activates and sets options for ARD.
# Defines the location of the generic.ppd in OS X 10.6
kickstart="/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart"
systemsetup="/usr/sbin/systemsetup"
genericppd="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/Resources/Generic.ppd"
# Delete iMovie (Previous Version) Directory if it exists, because we don't need it. Use when installing iLife using the original installers with InstaDMG.
rm -R /Applications/iMovie\ \(previous\ version\).localized/
# ARD Configuration
#Enable ARD for localadmin
$kickstart -configure -allowAccessFor -specifiedUsers
$kickstart -activate -configure -access -on -users "localadmin" -privs -all -restart -agent
# Set time zone and time server.
$systemsetup -setusingnetworktime on
$systemsetup -settimezone America/New_York -setnetworktimeserver time.apple.com
#Update NTP
ntpdate -bvs time.apple.com
#Disable Airport
networksetup -setnetworkserviceenabled AirPort off
# Activate WakeOnLAN.
$systemsetup -setwakeonnetworkaccess on
#Kerberos-Enabled SSH Authentication. Also specifies which specific groups are allowed to ssh.
echo KerberosAuthentication yes >> /etc/sshd_config
echo KerberosOrLocalPasswd yes >> /etc/sshd_config
echo AllowGroups domaingroup admin >> /etc/sshd_config
#disable ipv6
networksetup -setv6off Ethernet
#Firewall Settings | 0 = Off | 1 = On For Specific Services | 2 = On For Essential Services
defaults write /Library/Preferences/com.apple.alf globalstate -int 0
#Set System Sleep Preferences | 0 = Off | 15 = 15 Min | 20 = 20 Min | etc |
pmset sleep 0
#Sets HostName
scutil --set HostName $(scutil --get LocalHostName)
#Adds Printers
lpadmin -p "Printer Name" -L "Printer Location" -D "Printer Description" -E -v lpd://server/printqueue -P $genericppd -o printer-is-shared=false
#Removes Time Machine from the menu
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup 1
#Reboot in 1 minute
sleep 60
reboot
# Delete the script and the launchd item.
srm /Library/LaunchDaemons/com.company.firstboot.plist
srm "$0"