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;
/* 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);
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;
}