From: Javier Martinez Canillas Date: Fri, 15 Jun 2018 08:36:27 +0000 (+0200) Subject: 51-dracut-rescue.install: fix exit status code X-Git-Tag: 048~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f553878293ecf7dbe167bf245e1e5fe7ccc9656;p=thirdparty%2Fdracut.git 51-dracut-rescue.install: fix exit status code After the $COMMAND case statement, the exit status of the last executed command is added to the $ret variable. But for the "add" pattern, this last executed command is an arithmetic expression that also adds the exit status $? to the $ret variable. If both $? and $ret are 0, then the arithmetic expression evaluates to 0 so is considered false and has an exit status of 1. This makes the script to wrongly exit with an status code of 1 when it should had been 0. case "$COMMAND" in add) ... ((ret+=$?)) # $ret is 0 here ;; ... esac ((ret+=$?)) # $ ret is 1 here exit $ret Since $ret is set in the case statement, just exit with that status code and remove the last arithmetic expression that wrongly sets $ret to 1. Signed-off-by: Javier Martinez Canillas --- diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install index 679e94b1b..26878929b 100755 --- a/51-dracut-rescue.install +++ b/51-dracut-rescue.install @@ -132,6 +132,4 @@ case "$COMMAND" in ret=1;; esac -((ret+=$?)) - exit $ret