All pastes #393473 Raw Edit

HD Creation PW

public shellscript v1 · immutable
·published 2007-03-13 16:16 UTC
rendered paste body
#!/bin/bash#Simple shell script that creates the partition for Backtrack HD Install using Parallels#Author: Budh, budh -at- nagologic -dot- comecho "Welcome, this script will set up your hard drives to install Backtrack2"echo "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 BOOTP	echo -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	#Warns the user that formatting procedure is taking place.clearecho "WARNING!!"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 "Creating the partitions..."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 [ "$?" ]; then        echo "Partition creation failed on"	exitelse        echo "Partition creation was successfull"fi fdisk /dev/hda <<< $'p\nq\n';echo "Formating the drives..."mkfs.ext3 /dev/hda1 >/dev/nullif [ "$?" ]; then        echo "mkfs.ext3 failed"	exitfi mkfs.ext3 /dev/hda3 >/dev/nullif [ "$?" ]; then        echo "mkfs.ext3 failed"	exitfimkswap /dev/hda2swapon /dev/hda2echo "Mounting partition..."mkdir /tmp/bootmkdir /tmp/BT2fmount /dev/hda1 /tmp/bootmount /dev/hda3 /tmp/BT2fecho "Script is completed..."exit