Skip to content

Commit d437970

Browse files
ahesfordharaldh
authored andcommitted
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.
1 parent f8b38ec commit d437970

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dracut-init.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,13 @@ inst_symlink() {
258258

259259
inst_multiple() {
260260
local _ret
261-
if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
261+
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
262+
return 0
263+
else
262264
_ret=$?
263265
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} "$@" || :
264266
return $_ret
265267
fi
266-
return 0
267268
}
268269

269270
dracut_install() {

0 commit comments

Comments
 (0)