]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: Gracefully handle missing bootloader directory
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Apr 2023 10:17:18 +0000 (12:17 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Apr 2023 08:34:34 +0000 (10:34 +0200)
When --graceful is specified, let's gracefully deal with a missing
bootloader directory.

src/boot/bootctl-install.c

index dc8596fa05aa4c7843a75782044cb5bd767016b0..2dd50360ecd471a21a1600fcf566a6a39e252f7e 100644 (file)
@@ -391,6 +391,10 @@ static int install_binaries(const char *esp_path, const char *arch, bool force)
         /* If we had a root directory to try, we didn't find it and we are in auto mode, retry on the host */
         if (r == -ENOENT && root && arg_install_source == ARG_INSTALL_SOURCE_AUTO)
                 r = chase_and_opendir(BOOTLIBDIR, NULL, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, &path, &d);
+        if (r == -ENOENT && arg_graceful) {
+                log_debug("Source directory does not exist, ignoring.");
+                return 0;
+        }
         if (r < 0)
                 return log_error_errno(r, "Failed to open boot loader directory %s%s: %m", strempty(root), BOOTLIBDIR);