ASR via Terminal - help with restore

I’m wanting to have a way to Restore a volume using ASR with a specified image (dmg) by simply clicking an icon on the desktop. Is applescript the way to go or ?? I’m booting from a firewire drive (10.4.9+) and can manually open terminal and execute (which runs flawless): sudo asr restore -source /Volumes/TechDrive/Image1.dmg -target /Volumes/MacHD/ -erase -noprompt

My offhand thought is that this should work. In my example above, I’ve shortened filenames but in actuality I have spaces in the filenames, volumes, and such. I’ve used a single quote to surround the filenames appropriately.

This compiles fine but when run it also opens a Sendmail window and flings a few error messages. I’ve been using macs & OSX for a few simple weeks so bear with me…

set shell_cmd to "sudo asr restore -source /Volumes/'Tech Drive Data/2 Images and Builds/ELL ELPA Testing iBook Lab 2007-11-26/ELL ELPA Testing iBook Lab 2007-11-26.dmg' -target /Volumes/'Macintosh HD -erase -noprompt'"
tell application "Terminal"
	do script shell_cmd
end tell

When I get this working, how can I turn it into an application or executable script that will run instead of just open in script editor…is it just a filename extension change from .scpt?

Script Editor tells me it is: v2.1.1(81); AppleScript 1.10.7

Welcome. :slight_smile:

The last quote is misplaced in your example. You could also use quoted form:

set shell_cmd to "sudo asr restore -source " & quoted form of "/Volumes/Tech Drive Data/2 Images and Builds/ELL ELPA Testing iBook Lab 2007-11-26/ELL ELPA Testing iBook Lab 2007-11-26.dmg" & " -target " & quoted form of "/Volumes/'Macintosh HD" & " -erase -noprompt"
tell application "Terminal"
	do script shell_cmd
end tell

Once it works, you can use Script Editor to save it as an application bundle.