Ok my objective here is to have a run-once loginhook which deploys a winclone image. I have my OSX image set to auto-login, and I want the login hook to disable auto-login after it runs. I also want to designate the newly installed windows to become the default boot choice as it needs to reboot itself 4 times to complete the chkdisk, unattended installation, and its rename/join domain scripts. After that I've got windows set to run an autoIT application automatically which switches the default boot partition back to OSX.
So basically I can use deploystudio or altiris or asr or carbon copy cloner to deploy my OSX image. Then I'd reboot and it'll auto-login, install the winclone image, disable auto-login, set the newly installed windows as the startup disk, reboot itself in windows multiple times to complete the installation, then set itself back to osx as the startup disk so it'll sit in bootpicker.
Anyway, I'm using Leopard 10.5.8 and WinXP SP3. The following are not working:
auto-login is not being disabled
startup disk not being set
not rebooting
Code:
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH
# Automated winclone image deployment script
## Image variables
volume="/Volumes/Macintosh HD"
ntfs_image="$volume/Users/administrator/Desktop/XP_Sept2009_imac_student_image.winclone"
# NOT WORKING!!!
#disable auto-login for administrator and in general
defaults delete /Library/Preferences/com.apple.loginwindow administrator
defaults write /Library/Preferences/.GlobalPreferences com.apple.userspref.DisableAutoLogin -bool true
# Remove login hook for this script
# The script will only run once automatically
#Works
mv /Users/administrator/Desktop/Admin\ Scripts/deploy_winclone.sh /Users/administrator/Desktop/Admin\ Scripts/deploy_winclone1.sh
#Doesn't Work
#defaults delete com.apple.loginwindow LoginHook /Users/administrator/Desktop/Admin\ Scripts\deploy_winclone.sh
#Deploy winclone image
echo "Restoring disk image to target volume..."
exec "$ntfs_image/winclone.perl" -self-extract -ntfs_partition=/dev/disk0s3
# Reboot to windows
# An autoIT application will change startup disk back to OSX after windows has bound to the domain
#Doesn't Work!
bless -mount "/Volumes/Untitled/" -legacy -setBoot
shutdown -r now