Setting launchd dependancy for first time run script
I am looking for a way for a launchd item to run at login window but prior to user authenticated
I have read http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man5/launchd.plist.5.html
And believe I need to be looking at a socket. But just don't know what one
What I wanted to achieve as a launchd item that at first boot would set the computer name to serial of machine and then do all the updates from the server
Easy enough, But the thing I thought would be good would be to lock the desktop screen while this happens for end user netboot deployment's so the end user can not login to the machine while updates are in progress.
I came up with this idea
Utilize the inbuilt ARD client function
So script would be as follows
#!/bin/sh
open /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app
say "setting computer name"
SerialNumber=`/usr/sbin/system_profiler SPHardwareDataType |awk '/Serial/ { print $NF }'`
if [ -z "$SerialNumber" ]; then
echo "Logic board has been changed and no serial number found"
SerialNumber="BASESOE-"`date "+%Y%m%d"`
/usr/sbin/scutil --set ComputerName "$SerialNumber"
/usr/sbin/scutil --set LocalHostName "$SerialNumber"
else
echo "Setting Computer name and Local Host Name to $SerialNumber"
/usr/sbin/scutil --set ComputerName "$SerialNumber"
/usr/sbin/scutil --set LocalHostName "$SerialNumber"
fi
say "updating software"
softwareupdate -i -a
killall LockScreen
say "rebooting computer"
reboot
# Destroy this script!
srm "$0"
So nice and simple building block above and works. The catch is when I launch with launchd it loads script prior to login window and
"open /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app"
will not lock screen in time
I am looking for anyone who may have come across this before and can set a dependancy on login window launching first etc..
Have tried the following with no success.. Any suggestions would be great.
Disabled
KeepAlive
Label
com.domain.firstime
ProgramArguments
/usr/sbin/runfirsttime.sh
QueueDirectories
RunAtLoad
WatchPaths
LimitLoadToSessionType
LoginWindow