]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: if a plugin fails, return error immediately
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 26 May 2022 18:56:12 +0000 (20:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 26 May 2022 19:46:58 +0000 (21:46 +0200)
Since the first version in 81516adcb71a47837544340f72eb8ee810274119,
kernel-install would "gather" a return value by summing the exit codes
of the plugins… This makes no sense, because those are not additive values.

Let's just break off immediately. We now implement cleanup via trap, so if we
break, we should leave no garbage behind.

src/kernel-install/kernel-install.in

index 5f88ac2490ee1a880716f1dc58451198a6d658ed..9296bfcd8e8c66378d7362c51e08126bcc2427d2 100755 (executable)
@@ -336,7 +336,7 @@ case "$COMMAND" in
 
             err=$?
             [ $err -eq $skip_remaining ] && break
-            ret=$(( ret + err ))
+            [ $err -ne 0 ] && exit $err
         done
         ;;
 
@@ -346,7 +346,7 @@ case "$COMMAND" in
             "$f" remove "$KERNEL_VERSION" "$ENTRY_DIR_ABS"
             err=$?
             [ $err -eq $skip_remaining ] && break
-            ret=$(( ret + err ))
+            [ $err -ne 0 ] && exit $err
         done
 
         if [ "$MAKE_ENTRY_DIR_ABS" -eq 0 ]; then