From 78009b58e39793c8016be2faa04c0f62b7dfd918 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sun, 10 Sep 2017 19:34:14 +0200 Subject: Prefer syslinux files available on the computer. We will use our own copy of syslinux files only as a fallback, because it is safer to use the versions of files that come with syslinux on the computer which runs iso2usb.sh. --- iso2usb.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'iso2usb.sh') 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 -- cgit v1.2.3