From: Michael Prokop Date: Fri, 16 Jul 2021 16:21:13 +0000 (+0200) Subject: Immediately bail out on errors when generating the ISO fails X-Git-Tag: v0.39.0~1 X-Git-Url: https://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=e703806c51d092c9934315da996e66d18fe7a5d1 Immediately bail out on errors when generating the ISO fails For example when the file system is (close to) full and trying to generate the ISO, the $MKISOFS command line fails with exit code 32, but we continue to operate on the ISO filename with the isohybrid related actions and might overwrite the ISO by resetting it. --- diff --git a/grml-live b/grml-live index 3a8c8e7..beee3c8 100755 --- a/grml-live +++ b/grml-live @@ -1589,9 +1589,19 @@ else eend $? log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad -o ${ISO_OUTPUT}/${ISO_NAME} ." + einfo "Generating ISO file..." $MKISOFS -V "${GRML_NAME} ${VERSION}" -publisher 'grml-live | grml.org' \ -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad \ -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$? + eend $RC + + # do not continue on errors, otherwise we might generate/overwrite the ISO with dd if=... stuff + if [ "$RC" != 0 ] ; then + log "Error: critical error while generating ISO [exit code ${RC}]. Exiting." + eerror "Error: critical error while generating ISO [exit code ${RC}]. Exiting." ; eend 1 + bailout $RC + fi + # both of these need core.img there, so it’s easier to write it here if [ "$BOOT_METHOD" = "grub2" ] || [ "$HYBRID_METHOD" = "grub2" ]; then # must be <= 30720 bytes