]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Check that mkisofs equivalent supports the required options
authorMichael Brown <mcb30@ipxe.org>
Sun, 24 Jan 2021 12:15:20 +0000 (12:15 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 24 Jan 2021 12:19:48 +0000 (12:19 +0000)
The "-e" option required for creating EFI boot images is supported
only by widely used patched versions of genisoimage.

Check that the required options are supported when selecting a mkisofs
equivalent, thereby allowing a fallback to the use of xorrisofs when
building a UEFI ISO image on a system with an unpatched version of
genisoimage.

Continue to prefer the use of genisoimage over xorrisofs, since there
is apparently no way to inhibit the irritatingly useless startup
banner message printed by xorrisofs even when the "-quiet" option is
specified.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/genfsimg

index b9d5b3f44c5f0b4335eafb09a751c31f75ea1111..9fc9b6869d46e24f6f50526e015ae396d9b91e1c 100755 (executable)
@@ -171,23 +171,6 @@ case "${OUTFILE}" in
        SYSLINUXCFG="${FATDIR}/syslinux.cfg"
        ;;
 esac
-ISOARGS=
-
-# Locate required tools
-#
-if [ -n "${ISOIMG}" ] ; then
-    MKISOFS=
-    for CMD in genisoimage mkisofs xorrisofs ; do
-       if ${CMD} --version >/dev/null 2>/dev/null ; then
-           MKISOFS="${CMD}"
-           break
-       fi
-    done
-    if [ -z "${MKISOFS}" ] ; then
-       echo "${0}: cannot find mkisofs or equivalent" >&2
-       exit 1
-    fi
-fi
 
 # Copy files to temporary working directory
 #
@@ -240,6 +223,7 @@ done
 # since isohybrid will refuse to work without them.
 #
 if [ -n "${ISOIMG}" ] ; then
+    ISOARGS="-J -R"
     copy_syslinux_file "isolinux.bin" "${ISODIR}"
     copy_syslinux_file "ldlinux.c32" "${ISODIR}" || true
     ISOARGS="${ISOARGS} -no-emul-boot -eltorito-boot isolinux.bin"
@@ -276,11 +260,22 @@ fi
 # Create ISO filesystem image, if applicable
 #
 if [ -n "${ISOIMG}" ] ; then
+    MKISOFS=
+    for CMD in genisoimage mkisofs xorrisofs ; do
+       if "${CMD}" ${ISOARGS} --version "${ISODIR}" >/dev/null 2>&1 ; then
+           MKISOFS="${CMD}"
+           break
+       fi
+    done
+    if [ -z "${MKISOFS}" ] ; then
+       echo "${0}: cannot find a suitable mkisofs or equivalent" >&2
+       exit 1
+    fi
     "${MKISOFS}" -quiet -volid "iPXE" -preparer "iPXE build system" \
            -appid "iPXE - Open Source Network Boot Firmware" \
-           -publisher "ipxe.org" -sysid "iPXE" -J -R -o "${ISOIMG}" \
+           -publisher "ipxe.org" -sysid "iPXE" -o "${ISOIMG}" \
            ${ISOARGS} "${ISODIR}"
-    if isohybrid --version >/dev/null 2>/dev/null ; then
+    if isohybrid --version >/dev/null 2>&1 ; then
        isohybrid "${ISOIMG}"
     fi
 fi