<HTML>
<HEAD>
<TITLE>Using a script to deploy a restore partition</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hello all,<BR>
<BR>
In the interest of promoting &#8220;no-touch deploys&#8221;, here is a script that I run as a &#8220;before&#8221; script to deploy a Restore partition when imaging new machines with Casper.<BR>
<BR>
This runs and has been tested in 10.5.2. &nbsp;Even if you are running Tiger in your organization, you can use this script if your restore/utility images are Leopard.<BR>
<BR>
Note: In my environment, the /Users directory lives on a partition called Data. &nbsp;I recommend this configuration as it allows you to do whatever you like to the boot drive without worrying about your clients&#8217; data.<BR>
<BR>
################################################<BR>
#!/bin/sh<BR>
<BR>
## SCRIPT PARAMETERS <BR>
volume='/Volumes/Macintosh HD'<BR>
mac='20g'<BR>
restore='20g'<BR>
data='0b'<BR>
<BR>
# If restore partition does not exist, resize Macintosh HD and create Restore and Data partitions.<BR>
if test -e /Volumes/Restore<BR>
&nbsp;&nbsp;&nbsp;&nbsp;then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Restore partition already exists. <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Restore partition already exists.&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Restore partition does not exist.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Resizing Partitions...&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/sbin/diskutil resizeVolume &quot;$volume&quot; $mac JHFS+ Restore $restore JHFS+ Data $data<BR>
fi<BR>
<BR>
<BR>
# Copy the restore image to the data partition<BR>
echo &quot;Copying Restore image...&quot;<BR>
ditto /Volumes/CasperShare/Packages/Restore_Image_Leopard.dmg /Volumes/Data/Packages/Restore_Image_Leopard.dmg<BR>
<BR>
# Apply Restore image with asr<BR>
echo &quot;Restore the Restore with ASR&quot;<BR>
/usr/sbin/asr restore -source /Volumes/Data/Packages/Restore_Image_Leopard.dmg -target /Volumes/Restore -erase -noprompt -noverify<BR>
<BR>
# Remove cached package from Data partition<BR>
rm -Rf /Volumes/Data/Packages<BR>
<BR>
echo &quot;Restore image has been deployed.&quot;<BR>
<BR>
################################################<BR>
<BR>
-- <BR>
Miles Leacy<BR>
Senior Macintosh Technician<BR>
Polo Ralph Lauren<BR>
212-318-7603<BR>
miles.leacy@poloralphlauren.com<BR>
</SPAN></FONT></FONT>
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law. These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited. Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication. If you have received this communication in error, please immediately notify the sender and delete the message from your system.
</BODY>
</HTML>