Login    Forum    Register    Search    FAQ

Board index » PKGImage » PKGImage Scripts




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Winclone script partitally working
 Post Posted: Tue Sep 15, 2009 4:13 pm 
Offline
Just started
Just started

Joined: Tue Sep 15, 2009 4:03 pm
Posts: 4
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


Last edited by arkaine23 on Fri Sep 25, 2009 4:25 am, edited 1 time in total.

Top 
 Profile E-mail  
 
 Post subject: Re: Winclone script partitally working
 Post Posted: Tue Sep 15, 2009 4:39 pm 
Offline
Need to get out more
Need to get out more
User avatar

Joined: Wed May 18, 2005 3:53 pm
Posts: 293
Location: UK
Hi arkaine23

Couple of bits

How are you creating the volume for windows?

try
Code:
diskutil resizeVolume $volume "size in G" MS-DOS Windows "size in G"



Change
Code:
# NOT WORKING!!!
#disable auto-login for administrator and in general
[b][i]defaults delete /Library/Preferences/com.apple.loginwindow administrator
defaults write /Library/Preferences/.GlobalPreferences com.apple.userspref.DisableAutoLogin -bool true[/b][/i]


to

Code:
defaults delete /Library/Preferences/com.apple.loginwindow autoLoginUser
srm /etc/kcpassword



Change
Code:
#Doesn't Work
#defaults delete com.apple.loginwindow LoginHook /Users/administrator/Desktop/Admin\ Scripts\deploy_winclone.sh


to
Code:
defaults delete /var/root/Library/Preferences/com.apple.loginwindow LoginHook

_________________
http://www.apple-scripts.com


Top 
 Profile E-mail  
 
 Post subject: Re: Winclone script partitally working
 Post Posted: Fri Sep 25, 2009 3:01 am 
Offline
Just started
Just started

Joined: Tue Sep 15, 2009 4:03 pm
Posts: 4
Used bootcamp assistant to split the drive. Everything I've read about trying to do it with the commandline says there are too many complications/considerations to make it work right and have both the osx and windows volumes come out of it bootable.

So that's fine I removed all the code I'd tried to non-destructively resize the partitions. Would've been nice to have the script do it, and it did work so long as I didn't intend to have a bootable windows installation on the ntfs partition. I'm fine with that. We boot camp the macs when we pull them out of the box. After that we don't worry about it can can image them as much as we like.

Got the loginhook run-once part to work by setting the script to rename itself at the end of its run.

Am editing the script now and will see if your recommendations will disable auto-login.


Top 
 Profile E-mail  
 
 Post subject: Re: Winclone script partitally working
 Post Posted: Fri Sep 25, 2009 4:20 am 
Offline
Just started
Just started

Joined: Tue Sep 15, 2009 4:03 pm
Posts: 4
Confirmed that auto-login is now being disabled.

So now the point of failure is that I can't get it to set the Windows volume as the startup disk. And it doesn't reboot.

I know the reboot command is fine. This is running as root since its a loginhook, right? I've got my sudoers set so I could sudo inside the script if I have to.

As for setting the startup disk to windows. When I run the command I'm trying in a terminal, I get an error "cant's statfs /Volumes/Untitled/". I see some apple-scripts out there, but they're basically calling the exact same shell commands I'm trying to run to do this.

I wonder if its because the volume needs to chkdsk itself. That's the first thing it does when booting into the freshly deployed windows image.


Top 
 Profile E-mail  
 
 Post subject: Re: Winclone script partitally working
 Post Posted: Fri Sep 25, 2009 4:31 am 
Offline
Just started
Just started

Joined: Tue Sep 15, 2009 4:03 pm
Posts: 4
Confirmed that auto-login is now being disabled.

So now the point of failure is that I can't get it to set the Windows volume as the startup disk. And it doesn't reboot.

I know the reboot command is fine. This is running as root since its a loginhook, right? I've got my sudoers set so I could sudo inside the script if I have to.

As for setting the startup disk to windows. When I run the command I'm trying in a terminal, I get an error "cant's statfs /Volumes/Untitled/". I see some apple-scripts out there, but they're basically calling the exact same shell commands I'm trying to run to do this.

I wonder if its because the volume needs to chkdsk itself. That's the first thing it does when booting into the freshly deployed windows image. Seems to be. Just checked system prefs, and even the GUI doesn't give me the option to change startup disk to windows right after installing the winclone image.


Top 
 Profile E-mail  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 5 posts ] 

Board index » PKGImage » PKGImage Scripts


Who is online

Users browsing this forum: No registered users and 0 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron