]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/write_usb_boot_partition
a7164691e688f42386843f35a5e7dbc5e8217d83
[bacula/rescue] / rescue / linux / usb / write_usb_boot_partition
1 #!/bin/sh
2 #
3 # tar the disk image
4 #
5 . ./config
6
7 if [ ! `whoami` = "root" ] ; then
8   echo ""
9   echo "You need to be root to run this shell script"
10   echo ""
11   exit 1
12 fi
13 if [ ! -f ${BOOT_IMAGE} ] ; then
14   echo "Could not find boot image: ${BOOT_IMAGE}"
15   exit 1
16 fi
17
18 umount ${USB_DEV}1 2>/dev/null 1>/dev/null
19
20 echo "Reformat USB boot partition"
21 mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1
22 if [ ! -d ${MOUNT_POINT}/kubuntu8 ] ; then
23    mkdir -p ${MOUNT_POINT}/kubuntu8
24    created="yes"
25 fi
26 mount ${USB_DEV}1 ${MOUNT_POINT}/kubuntu8
27 if [ $? -ne 0 ] ; then
28   echo "Mount of USB boot partition failed."
29   exit 1
30 fi
31 cd ${MOUNT_POINT}/kubuntu8
32 if [ $? -ne 0 ] ; then
33   echo "Could not cd to USB boot partition"
34   exit 1
35 fi
36
37 echo "Detaring boot image ..."
38 tar xfz ${BOOT_IMAGE}
39 cd ${CWD}
40
41 syslinux -sf ${USB_DEV}1
42 install-mbr -p1 ${USB_DEV}
43 echo "syncing ..."
44 sync
45 sync
46 umount ${MOUNT_POINT}/kubuntu8
47 if [ "x$created" = "xyes" ] ; then
48    rmdir ${MOUNT_POINT}/kubuntu8
49 fi