X-Git-Url: https://git.sur5r.net/?p=bacula%2Frescue;a=blobdiff_plain;f=rescue%2Flinux%2Foldusb%2Fwrite_usb_boot_partition;fp=rescue%2Flinux%2Foldusb%2Fwrite_usb_boot_partition;h=7c64a5fd82189104c381f91e2fb184e574be66ba;hp=0000000000000000000000000000000000000000;hb=fb21b5066e01a80263767f2406829a10dfa58303;hpb=0a3515b92eb06f0fee16cee0f189ae5aa83b4414 diff --git a/rescue/linux/oldusb/write_usb_boot_partition b/rescue/linux/oldusb/write_usb_boot_partition new file mode 100755 index 0000000..7c64a5f --- /dev/null +++ b/rescue/linux/oldusb/write_usb_boot_partition @@ -0,0 +1,66 @@ +#!/bin/sh +# +# tar the disk image +# +. ./config + +if [ ! `whoami` = "root" ] ; then + echo "" + echo "You need to be root to run this shell script" + echo "" + exit 1 +fi +if [ ! -f ${BOOT_IMAGE} ] ; then + echo "Could not find boot image: ${BOOT_IMAGE}" + exit 1 +fi +if [ "`which syslinux`x" = "x" ] ; then + echo "" + echo "Could not find syslinux. Try \"apt-get install syslinux\"" + echo "" + exit 1 +fi +if [ "`which install-mbr`x" = "x" ] ; then + echo "" + echo "Could not find install-mbr. Try \"apt-get install mbr\"" + echo "" + 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." + exit 1 +fi +cd ${MOUNT_POINT}/kubuntu8 +if [ $? -ne 0 ] ; then + echo "Could not cd to USB boot partition" + exit 1 +fi + +echo "Detaring boot image ..." +tar xfz ${BOOT_IMAGE} +# original-partioning.txt was created by partition_usb_key +if [ -e ${CWD}/original-partitioning.txt ] ; then + cp -f ${CWD}/original-partitioning.txt . + rm -f ${CWD}/original-partitioning.txt +fi +cd ${CWD} + +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