Need Guidance in Building an app With Sh Script Commands

10-11  Source: Network gathering  Views:2 

Advertisement
Let me start off by saying this will be long:
I've been tasked with creating an application at work that provides a GUI interface to the user while it runs a shell script in the background. I have very limited experience with Xcode and the developer tools so please explain in simplest terms possible
On to the application. It will be broken down into five different GUI windows. I know I need to use IB, but thats about as far as I know how to pull this off.
1. Intro screen that gives a description of the program and a start button.
2. Asks the user to specify the location where they want to save their image and provide a name for it,then a next button. (I would like to do a drag and drop field if that is possible where they could drag the folder and the path would be read and have whatever name they type automatically append .dmg onto the end)
3. This window asks them to drag and drop (if possible) the windows partition into the window, and then click next.
4. A progress bar
5. Successfully finished.
There is an additional unix file that script calls as well
The script which needs to be modified to work for this program is:
#!/bin/sh
echo ""
echo ""
echo ""
echo "This script will create a sparsebundle for Windows imaging."
echo ""
echo "Please make sure to have an external Firewire drive to where your image will be saved connected to your machine"
echo ""
#echo "Type in how large you want your sparsebundle to be (ie 50g for 50 Gigabytes):"
#read "hd_size"
echo "MAKE SURE TO PRESS ENTER AFTER EACH STEP!!!"
echo "MAKE SURE TO RUN AS ROOT!!!"
echo ""
echo "Drag the icon of the folder or device you want to save your Windows image INTO this window (Because of the large size of the file that will be created, it is recommended to use a firewire device and/or folder.):"
read "target_disk"
echo "Type in the name you want your final image to be called (include .dmg to the end of the name. i.e. LIBRN310_SPR09.dmg)"
read "Image_Name"
echo "Step 1: sparsebundle creation"
echo "Please wait while your sparsebundle is created"
target_folder="$target_disk/Windows_ntfsclone_image"
if [ -e $target_folder ]; then
echo "A folder with the name 'Windows_ntfsclone_image' already exists. Please delete or rename this folder and launch this script again."
exit 0;
fi
/bin/mkdir $target_disk/Windows_ntfsclone_image
hd_size="`diskutil list | grep Vista | awk '{print int(1+ $4)}'`g"
/usr/bin/hdiutil create -type SPARSEBUNDLE -layout NONE -size $hd_size $target_folder/windows
echo "Your sparsebundle has been created here: $target_folder/windows.sparsebundle"
echo ""
echo "Your sparsebundle is being attached to the system as a device..."
sparsebundle_Device="`/usr/bin/hdiutil attach -nomount $target_folder/windows.sparsebundle`"
echo ""
echo "Your sparsebundle has been attached."
echo ""
echo "Step 2: Cloning your Windows NTFS volume to the sparsebundle."
echo "Cloning your Windows volume to the sparsebundle..."
Vista_Volume="/Volumes/Vista"
Vista_Device="/dev/`/usr/sbin/diskutil list | grep Vista | awk '{print $6}'`"
/usr/sbin/diskutil unmount $Vista_Device
$HOME/Desktop/Windows_Imaging_Tools/ntfsclone -f -f -O $sparsebundle_Device $Vista_Device
echo ""
echo "Windows has cloned to your sparsebundle."
echo ""
echo "Detaching sparsebundle..."
/usr/sbin/diskutil eject $sparsebundle_Device
echo "sparsebundle detatched"
echo ""
echo "Step 3: Converting the sparsebundle to scannable UDIF image for Multicast or Unicast ASR."
echo "Converting Windows sparsebundle to compressed Apple UDIF image."
sparsebundle_File="$target_folder/windows.sparsebundle"
/bin/mkdir $target_folder/Windows_Final_Image
Windows_Image_Folder="$target_folder/Windows_Final_Image"
/usr/bin/hdiutil convert $sparsebundle_File -format UDCO -o $Windows_Image_Folder/$Image_Name
echo ""
echo "Your sparsebundle has been sucessfully converted."
echo "It is located at $Windows_Image_Folder/$Image_Name"
echo ""
echo "Step 4: Scanning your $Image_Name image for restore..."
/usr/sbin/asr imagescan -source $Windows_Image_Folder/$Image_Name
echo ""
echo "Your $Image_Name has finished scanning. You can now use the image located at $Windows_Image_Folder/$Image_Name for Multicast ASR or Unicast ASR."
exit 0;
Couple of options:
- Pashua: http://www.bluem.net/en/mac/pashua
- Platypus: http://www.sveinbjorn.org/platypus
Related articles