From: Yu Watanabe Date: Tue, 21 Mar 2023 09:44:51 +0000 (+0900) Subject: kernel-install: also parse KERNEL_INSTALL_LAYOUT from /etc/machine-info X-Git-Tag: v254-rc1~245^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fd2af1ab865e09ae66e7b7d295250b0b945846f;p=thirdparty%2Fsystemd.git kernel-install: also parse KERNEL_INSTALL_LAYOUT from /etc/machine-info For consistency with bootctl. --- diff --git a/src/kernel-install/kernel-install.c b/src/kernel-install/kernel-install.c index 5dde1eb2891..396bfc6d44f 100644 --- a/src/kernel-install/kernel-install.c +++ b/src/kernel-install/kernel-install.c @@ -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; }