aboutsummaryrefslogtreecommitdiffstats
path: root/iso2usb.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--iso2usb.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/iso2usb.sh b/iso2usb.sh
index eed490e..4a7e4f6 100644
--- a/iso2usb.sh
+++ b/iso2usb.sh
@@ -66,7 +66,18 @@ DOLUKS=0
REFRESH=0
# These tools are required by the script, we will check for their existence:
-REQTOOLS="blkid cpio extlinux fdisk gdisk isoinfo mkdosfs sgdisk"
+REQTOOLS="blkid cpio extlinux fdisk gdisk isoinfo mkdosfs sgdisk syslinux"
+
+# Path to syslinux files:
+if [ -d /usr/share/syslinux ]; then
+ SYSLXLOC="/usr/share/syslinux"
+elif [ -d /usr/lib/syslinux ]; then
+ SYSLXLOC="/usr/lib/syslinux"
+else
+ # Should not happen... in this case we use what we have on the ISO
+ # and hope for the best:
+ SYSLXLOC=""
+fi
# Initialize more variables:
CNTBASE=""
@@ -714,6 +725,11 @@ echo "--- Making the USB drive '$TARGET' bootable using extlinux..."
mv ${USBMNT}/boot/syslinux ${USBMNT}/boot/extlinux
mv ${USBMNT}/boot/extlinux/isolinux.cfg ${USBMNT}/boot/extlinux/extlinux.conf
rm -f ${USBMNT}/boot/extlinux/isolinux.*
+if [ -f "$SYSLXLOC"/vesamenu.c32 ]; then
+ # We will use our own copy only as a fallback,
+ # because it is better to use the version that comes with syslinux:
+ cp -a ${SYSLXLOC}/vesamenu.c32 ${USBMNT}/boot/extlinux/
+fi
extlinux --install ${USBMNT}/boot/extlinux
if [ $EFIBOOT -eq 1 ]; then
@@ -749,8 +765,10 @@ if mount |grep -qw ${US2MNT} ; then umount ${US2MNT} ; fi
cleanup
# Install a GPT compatible MBR record:
-if [ -f /usr/share/syslinux/gptmbr.bin ]; then
- cat /usr/share/syslinux/gptmbr.bin > ${TARGET}
+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}
else
echo "*** Failed to make USB device bootable - 'gptmbr.bin' not found!"
cleanup