* for setting up the ESP in /etc/machine-info. The newer /etc/kernel/entry-token file, as well as
* the $layout field in /etc/kernel/install.conf are better replacements for this though, hence this
* has been deprecated and is only returned for compatibility. */
- _cleanup_free_ char *s = NULL, *layout = NULL;
+ _cleanup_free_ char *p = NULL, *s = NULL, *layout = NULL;
int r;
- r = parse_env_file(NULL, "/etc/machine-info",
+ p = path_join(arg_root, "etc/machine-info");
+ if (!p)
+ return log_oom();
+
+ r = parse_env_file(NULL, p,
"KERNEL_INSTALL_LAYOUT", &layout,
"KERNEL_INSTALL_MACHINE_ID", &s);
if (r == -ENOENT)
_cleanup_free_ char *layout = NULL, *p = NULL;
int r;
- p = path_join(etc_kernel(), "install.conf");
+ p = path_join(arg_root, etc_kernel(), "install.conf");
if (!p)
return log_oom();
if (!arg_make_entry_directory && arg_entry_token_type == ARG_ENTRY_TOKEN_MACHINE_ID)
return 0;
- p = path_join(etc_kernel(), "entry-token");
+ p = path_join(arg_root, etc_kernel(), "entry-token");
if (!p)
return log_oom();
case ARG_ENTRY_TOKEN_AUTO: {
_cleanup_free_ char *buf = NULL, *p = NULL;
- p = path_join(etc_kernel(), "entry-token");
+ p = path_join(arg_root, etc_kernel(), "entry-token");
if (!p)
return log_oom();
r = read_one_line_file(p, &buf);
} else if (sd_id128_is_null(arg_machine_id)) {
_cleanup_free_ char *id = NULL, *image_id = NULL;
- r = parse_os_release(NULL,
+ r = parse_os_release(arg_root,
"IMAGE_ID", &image_id,
"ID", &id);
if (r < 0)
case ARG_ENTRY_TOKEN_OS_IMAGE_ID: {
_cleanup_free_ char *buf = NULL;
- r = parse_os_release(NULL, "IMAGE_ID", &buf);
+ r = parse_os_release(arg_root, "IMAGE_ID", &buf);
if (r < 0)
return log_error_errno(r, "Failed to load /etc/os-release: %m");
case ARG_ENTRY_TOKEN_OS_ID: {
_cleanup_free_ char *buf = NULL;
- r = parse_os_release(NULL, "ID", &buf);
+ r = parse_os_release(arg_root, "ID", &buf);
if (r < 0)
return log_error_errno(r, "Failed to load /etc/os-release: %m");
echo "Testing bootctl"
e2="${entry%+*}_2.conf"
cp "$entry" "$e2"
- export SYSTEMD_ESP_PATH=/
+ export SYSTEMD_ESP_PATH=/boot
+ # We use --root so strip the root prefix from KERNEL_INSTALL_CONF_ROOT
+ export KERNEL_INSTALL_CONF_ROOT="sources"
# create file that is not referenced. Check if cleanup removes
# it but leaves the rest alone
:> "$BOOT_ROOT/the-token/1.1.2/initrd"
- "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" cleanup
+ "$_KERNEL_INSTALL_BOOTCTL" --root="$D" cleanup
test ! -e "$BOOT_ROOT/the-token/1.1.2/initrd"
test -e "$BOOT_ROOT/the-token/1.1.2/linux"
test -e "$BOOT_ROOT/the-token/1.1.1/linux"
test -e "$BOOT_ROOT/the-token/1.1.1/initrd"
+
# now remove duplicated entry and make sure files are left over
- "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" unlink "${e2##*/}"
+ "$_KERNEL_INSTALL_BOOTCTL" --root="$D" unlink "${e2##*/}"
test -e "$BOOT_ROOT/the-token/1.1.1/linux"
test -e "$BOOT_ROOT/the-token/1.1.1/initrd"
test -e "$entry"
# remove last entry referencing those files
entry_id="${entry##*/}"
entry_id="${entry_id%+*}.conf"
- "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" unlink "$entry_id"
+ "$_KERNEL_INSTALL_BOOTCTL" --root="$D" unlink "$entry_id"
test ! -e "$entry"
test ! -e "$BOOT_ROOT/the-token/1.1.1/linux"
test ! -e "$BOOT_ROOT/the-token/1.1.1/initrd"