summaryrefslogtreecommitdiffstats
path: root/iso2usb.sh
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2019-11-19 21:37:05 +0100
committer Eric Hameleers <alien@slackware.com>2019-11-19 21:37:05 +0100
commit14a88e4ee227c59246f8fea29e2ea38ad6303877 (patch)
tree8dbc30682d590fb1579bca476ccc2796a97b7bfb /iso2usb.sh
parente0a259a3d59b47b1d8fe2b2365b5106aa221ac0a (diff)
downloadliveslak-14a88e4ee227c59246f8fea29e2ea38ad6303877.tar.gz
liveslak-14a88e4ee227c59246f8fea29e2ea38ad6303877.tar.xz
iso2usb.sh: fix logic for finding and writing gptmbr.bin to the device
Diffstat (limited to '')
-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