]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/usb/partitionusbkey
Update
[bacula/rescue] / rescue / linux / usb / partitionusbkey
index 67cdb51b60b7b6854e7694a85d0f50fe31007549..825400a82c7d0011e5077a0b13f3d428f4f223ea 100755 (executable)
@@ -4,6 +4,7 @@
 #
 # First delete all existing partitions
 #
+. ./config
 
 if [ ! `whoami` = "root" ] ; then
   echo ""
@@ -11,25 +12,25 @@ if [ ! `whoami` = "root" ] ; then
   echo ""
   exit 1
 fi
-if [ "x$USB_DEVICE" = "x" ] ; then
+if [ "x$USB_DEV" = "x" ] ; then
   if [ "x$1" = "x" ] ; then
-     echo "You must supply the USB device name on the command line or in USB_DEVICE"
+     echo "You must supply the USB device name on the command line or in USB_DEV"
      exit 1
   else
-     dev=$1
+     USB_DEV=$1
   fi
-else
-  dev=$USB_DEVICE
 fi
 echo "This script will distroy everything on $dev"
+fdisk -l $USB_DEV
+echo " "
 echo "Answer yes to continue "
 read a
 if [ "$a" != "yes" ] ; then
-  echo "Device $dev unchanged"
+  echo "Device $USB_DEV unchanged"
   exit 1
 fi
 
-fdisk $dev <<EOF
+fdisk $USB_DEV <<EOF
 d
 4
 d
@@ -42,7 +43,7 @@ n
 p
 1
 
-+900M
++750M
 t
 1
 6
@@ -61,10 +62,12 @@ p
 p
 w
 EOF
-umount ${dev}1
-mkfs.vfat -F 16 -n kubuntu8 ${dev}1
-umount ${dev}2
-mkfs.ext2 -j -b 4096 -L casper-rw ${dev}2
-umount ${dev}3
-mkfs.ext2 -j -b 4096 -L home-rw ${dev}3
+umount ${USB_DEV}1
+mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1
+umount ${USB_DEV}2
+mkfs.ext2 -j -b 4096 -L casper-rw ${USB_DEV}2
+umount ${USB_DEV}3
+mkfs.ext2 -j -b 4096 -L home-rw ${USB_DEV}3
+syslinux -sf ${USB_DEV}1
+install-mbr -p1 ${USB_DEV}
 sync