I need to create an apple script to perform DD Commands in sequence, to replicate the same .img file to multiple USB flash drives
The context: the computer is connected to a powered USB hub with 7 usb flash drives connected and unmounted by diskutil. No other USB devices or disk are connected to the computer (so the USB Sticks will be assign a disk1 - disk7 resource mapping)
The steps
- a file named "source.img" will be prepared and put on the desktop (say an .img of a bootable OS)
- terminal must be asked to change directory to the desktop
- with administrative privileges (the password can be inserted into the script, or asked once to the user) it must be asked to perform:
"sudo dd if=source.img of=/dev/rdisk1 bs=1m"
- the script must wait until the operation is concluded, then ask the terminal to perform another DD, to disk2 this time:
"sudo dd if=source.img of=/dev/rdisk2 bs=1m"
and again, wait until the operation is concluded, and then ask:
"sudo dd if=source.img of=/dev/rdisk3 bs=1m"
and so on with rdisk4, rdisk5, rdisk6, rdisk7.
- at the end of the disk7 operation , the script can shut down the terminal and send a finder message to the user (or an audio notification) that the USB Duplication process to the 7 flash drives is concluded.
It's a way to create a "USB duplicator on the cheap" for bootable images to be put on multiple sticks, I need it for a school project to my students.
Anybody can help ? I am a zero with Applescript. And this thing will be useful for many.
Thank you !
Alberto