From d437970c013e3287de263a1e60a117b15239896c Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Thu, 18 Feb 2021 18:53:15 -0500 Subject: [PATCH] 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. --- dracut-init.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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() { -- 2.47.3