]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: do not update sd-boot if it wasn't installed in the first place 22082/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Jan 2022 09:56:50 +0000 (10:56 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Jan 2022 09:57:36 +0000 (10:57 +0100)
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2038289.

src/boot/bootctl.c

index e21a183baf1c7cd179588f992fd6f9e268e98455..1bcb4d16899b0e090874e344e8820723574e56dd 100644 (file)
@@ -1791,6 +1791,17 @@ static int verb_install(int argc, char *argv[], void *userdata) {
         if (r < 0)
                 return r;
 
+        if (!install) {
+                /* If we are updating, don't do anything if sd-boot wasn't actually installed. */
+                r = are_we_installed();
+                if (r < 0)
+                        return r;
+                if (r == 0) {
+                        log_debug("Skipping update because sd-boot is not installed in the ESP.");
+                        return 0;
+                }
+        }
+
         r = acquire_xbootldr(/* unprivileged_mode= */ false, NULL);
         if (r < 0)
                 return r;