]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: also parse KERNEL_INSTALL_LAYOUT from /etc/machine-info
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 Mar 2023 09:44:51 +0000 (18:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Jun 2023 05:23:54 +0000 (14:23 +0900)
For consistency with bootctl.

src/kernel-install/kernel-install.c

index 5dde1eb28919d5bd2a942930158c03795dadd322..396bfc6d44f6ffa2f01701b58d054fcc13ac2c9a 100644 (file)
@@ -395,7 +395,7 @@ static int context_load_install_conf(Context *c) {
 
 static int context_load_machine_info(Context *c) {
         _cleanup_close_ int fd = -EBADF;
-        _cleanup_free_ char *machine_id = NULL;
+        _cleanup_free_ char *machine_id = NULL, *layout = NULL;
         static const char *path = "/etc/machine-info";
         int r;
 
@@ -404,7 +404,7 @@ static int context_load_machine_info(Context *c) {
         /* If the user configured an explicit machine ID in /etc/machine-info to use for our purpose, we'll
          * use that instead (for compatibility). */
 
-        if (!sd_id128_is_null(c->machine_id))
+        if (!sd_id128_is_null(c->machine_id) && c->layout >= 0)
                 return 0;
 
         r = chaseat(c->rfd, path, CHASE_AT_RESOLVE_IN_ROOT, NULL, &fd);
@@ -416,11 +416,13 @@ static int context_load_machine_info(Context *c) {
         log_debug("Loading %s…", path);
 
         r = parse_env_file_fd(fd, path,
-                              "KERNEL_INSTALL_MACHINE_ID", &machine_id);
+                              "KERNEL_INSTALL_MACHINE_ID", &machine_id,
+                              "KERNEL_INSTALL_LAYOUT", &layout);
         if (r < 0)
                 return log_error_errno(r, "Failed to parse '%s': %m", path);
 
         (void) context_set_machine_id(c, machine_id, path);
+        (void) context_set_layout(c, layout, path);
         return 0;
 }