]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-lib): support "set -e" in setdebug
authorBenjamin Drung <benjamin.drung@canonical.com>
Wed, 12 Feb 2025 10:10:30 +0000 (11:10 +0100)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Wed, 12 Feb 2025 13:50:58 +0000 (14:50 +0100)
A `return` statement will return with the exit code of the previous
command if no exit code is specified. In case `/usr/lib/initrd-release`
does not exist, `setdebug` will return with the exit code 1.

Return this function with code 0 in that case to support `set -e` users.

Fixes: 2b125c69cc80 ("base/dracut-lib.sh: do not setdebug, if not in initramfs")
modules.d/99base/dracut-lib.sh

index acedea98c37e94c757b8df4760130be39a446d07..05c361c62045ffa27dc738f7efdd5852eb2d0aef 100755 (executable)
@@ -340,7 +340,7 @@ splitsep() {
 }
 
 setdebug() {
-    [ -f /usr/lib/initrd-release ] || return
+    [ -f /usr/lib/initrd-release ] || return 0
     if [ -z "$RD_DEBUG" ]; then
         if [ -e /proc/cmdline ]; then
             RD_DEBUG=no