]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/usb/write_usb_boot_partition
Fix bat install broken by change
[bacula/rescue] / rescue / linux / usb / write_usb_boot_partition
index fe871b1f05850f8b6fe77552dddb6102e1c61ea4..a7164691e688f42386843f35a5e7dbc5e8217d83 100755 (executable)
@@ -10,10 +10,19 @@ if [ ! `whoami` = "root" ] ; then
   echo ""
   exit 1
 fi
+if [ ! -f ${BOOT_IMAGE} ] ; then
+  echo "Could not find boot image: ${BOOT_IMAGE}"
+  exit 1
+fi
 
 umount ${USB_DEV}1 2>/dev/null 1>/dev/null
+
 echo "Reformat USB boot partition"
 mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1
+if [ ! -d ${MOUNT_POINT}/kubuntu8 ] ; then
+   mkdir -p ${MOUNT_POINT}/kubuntu8
+   created="yes"
+fi
 mount ${USB_DEV}1 ${MOUNT_POINT}/kubuntu8
 if [ $? -ne 0 ] ; then
   echo "Mount of USB boot partition failed."
@@ -24,10 +33,17 @@ if [ $? -ne 0 ] ; then
   echo "Could not cd to USB boot partition"
   exit 1
 fi
+
 echo "Detaring boot image ..."
 tar xfz ${BOOT_IMAGE}
 cd ${CWD}
-ls -l ${MOUNT_POINT}/kubuntu8
+
+syslinux -sf ${USB_DEV}1
+install-mbr -p1 ${USB_DEV}
 echo "syncing ..."
 sync
+sync
 umount ${MOUNT_POINT}/kubuntu8
+if [ "x$created" = "xyes" ] ; then
+   rmdir ${MOUNT_POINT}/kubuntu8
+fi