#!/bin/bash#Simple shell script that creates the partition for Backtrack HD Install using Parallels#Author: Budh, budh -at- nagologic -dot- com#Warns the user that formatting procedure is taking place.clearecho "--== Welcome, this script will set up your hard drives to install Backtrack2 ==--"echo "---------------------------------------------------------------------------------"echo "This procedure will wipe the content of the current hard drive."echo -n "Are you sure you want to continue. (y/n): "; read sAnswerif [ $sAnswer = "n" ] ; then echo "Leaving..." exitfiecho "First we need to know what sizes you want your partitions to be"echo -n "Boot Partition size in MB ie 1GB = 1024MB (default 50): "; read BOOTPecho -n "Swap Partition size in MB ie 1GB = 1024MB (default 512)"; read SWAPP#echo -n "ROOT Partition size in MB ie 1GB = 1024MB"; read ROOTP echo "Creating the partitions... on /dev/hda"fdisk /dev/hda <<< $'n\np\n1\n\n+'"$BOOTP"$'M\nn\np\n2\n\n+'"$SWAPP"$'M\n\nn\np\n3\n\n\n\na\n1\nt\n2\n82\nw\nq\n' >/dev/nullif [ "$?" != "0"]; then echo "Partition creation failed on" exitelse echo "Partition creation was successfull"fiechofdisk /dev/hda <<< $'p\nq\n';echo "Formating the drives..."mkfs.ext3 /dev/hda1 >/dev/nullif [ "$?" != "0" ]; then echo "mkfs.ext3 failed" exitfimkfs.ext3 /dev/hda3 >/dev/nullif [ "$?" != "0" ]; then echo "mkfs.ext3 failed" exitfiecho "Formating the SWAP partition..."mkswap /dev/hda2swapon /dev/hda2echo "Mounting partition..."echo mkdir /tmp/bootecho mkdir /tmp/BT2fecho mount /dev/hda1 /tmp/bootecho mount /dev/hda3 /tmp/BT2fecho "Script is completed..."exit