summaryrefslogtreecommitdiffstats
path: root/iso2usb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'iso2usb.sh')
-rw-r--r--iso2usb.sh23
1 files changed, 14 insertions, 9 deletions
diff --git a/iso2usb.sh b/iso2usb.sh
index e8c7014..21248cb 100644
--- a/iso2usb.sh
+++ b/iso2usb.sh
@@ -77,12 +77,15 @@ REQTOOLS="blkid cpio extlinux fdisk gdisk isoinfo lsblk mkdosfs sgdisk syslinux"
# Path to syslinux files:
if [ -d /usr/share/syslinux ]; then
SYSLXLOC="/usr/share/syslinux"
+ GPTMBRBIN=$(find $SYSLXLOC -name gptmbr.bin)
elif [ -d /usr/lib/syslinux ]; then
SYSLXLOC="/usr/lib/syslinux"
+ GPTMBRBIN=$(find $SYSLXLOC -name gptmbr.bin)
else
# Should not happen... in this case we use what we have on the ISO
# and hope for the best:
- SYSLXLOC=""
+ SYSLXLOC="/"
+ GPTMBRBIN="gptmbr.bin"
fi
# Initialize more variables:
@@ -845,23 +848,25 @@ if [ $EFIBOOT -eq 1 ]; then
sync
fi
-# No longer needed:
+# No longer needed; umount the USB partitions so we can write a new MBR:
if mount |grep -qw ${USBMNT} ; then umount ${USBMNT} ; fi
if mount |grep -qw ${US2MNT} ; then umount ${US2MNT} ; fi
-# Unmount/remove stuff:
-cleanup
-
# Install a GPT compatible MBR record:
-if [ -f ${SYSLXLOC}/gptmbr.bin ]; then
- cat ${SYSLXLOC}/gptmbr.bin > ${TARGET}
-elif [ -f ${USBMNT}/boot/extlinux/gptmbr.bin ]; then
- cat ${USBMNT}/boot/extlinux/gptmbr.bin > ${TARGET}
+if [ -n "${GPTMBRBIN}" ]; then
+ if [ -f ${GPTMBRBIN} ]; then
+ cat ${GPTMBRBIN} > ${TARGET}
+ fi
+elif [ -f ${ISOMNT}/boot/syslinux/gptmbr.bin ]; then
+ cat ${ISOMNT}/boot/syslinux/gptmbr.bin > ${TARGET}
else
echo "*** Failed to make USB device bootable - 'gptmbr.bin' not found!"
cleanup
exit 1
fi
+# Unmount/remove stuff:
+cleanup
+
# THE END