From: Andrew J. Hesford Date: Thu, 18 Feb 2021 23:53:15 +0000 (-0500) Subject: fix: proper return code for inst_multiple in dracut-init.sh X-Git-Tag: 053~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d437970c013e3287de263a1e60a117b15239896c;p=thirdparty%2Fdracut.git fix: proper return code for inst_multiple in dracut-init.sh A test of the form if ! command; then _ret=$? ... return _ret fi does not capture the return code of `command`, but the negation of the return code, leaving _ret == 0. The test of this form in inst_multiple has been refactored to capture and return the right value. --- diff --git a/dracut-init.sh b/dracut-init.sh index d414c7e85..e4c7bd5e2 100644 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -258,12 +258,13 @@ inst_symlink() { inst_multiple() { local _ret - if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then + if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then + return 0 + else _ret=$? derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : return $_ret fi - return 0 } dracut_install() {