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 +++++++++++++++++++++--- make_slackware_live.sh | 3 +++ 2 files changed, 24 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 diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 37f95eb..f54e8f9 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -2227,6 +2227,9 @@ for SLFILE in message.txt f2.txt syslinux.cfg lang.cfg ; do -e "s/@SL_VERSION@/$SL_VERSION/g" fi done +# The iso2usb.sh script can use this copy of a MBR file as fallback: +cp -a /usr/share/syslinux/gptmbr.bin ${LIVE_STAGING}/boot/syslinux/ +# We have memtest in the syslinux bootmenu: mv ${LIVE_STAGING}/boot/syslinux/memtest ${LIVE_STAGING}/boot/ # Make use of proper console font if we have it available: -- cgit v1.2.3