bootctl: add --root and --image

Operate on image/directory, and also take files to install from it
This commit is contained in:
Luca Boccassi
2022-07-08 16:58:15 +01:00
parent 99080ed3f0
commit 80a2381d5c
11 changed files with 265 additions and 87 deletions
+6 -6
View File
@@ -840,12 +840,12 @@ static int boot_entries_select_selected(const BootConfig *config) {
return boot_config_find(config, config->entry_selected);
}
static int boot_load_efi_entry_pointers(BootConfig *config) {
static int boot_load_efi_entry_pointers(BootConfig *config, bool skip_efivars) {
int r;
assert(config);
if (!is_efi_boot())
if (skip_efivars || !is_efi_boot())
return 0;
/* Loads the three "pointers" to boot loader entries from their EFI variables */
@@ -871,12 +871,12 @@ static int boot_load_efi_entry_pointers(BootConfig *config) {
return 1;
}
int boot_config_select_special_entries(BootConfig *config) {
int boot_config_select_special_entries(BootConfig *config, bool skip_efivars) {
int r;
assert(config);
r = boot_load_efi_entry_pointers(config);
r = boot_load_efi_entry_pointers(config, skip_efivars);
if (r < 0)
return r;
@@ -967,11 +967,11 @@ int boot_config_load_auto(
"Failed to determine whether /run/boot-loader-entries/ exists: %m");
}
r = find_esp_and_warn(override_esp_path, /* unprivileged_mode= */ false, &esp_where, NULL, NULL, NULL, NULL, &esp_devid);
r = find_esp_and_warn(NULL, override_esp_path, /* unprivileged_mode= */ false, &esp_where, NULL, NULL, NULL, NULL, &esp_devid);
if (r < 0) /* we don't log about ENOKEY here, but propagate it, leaving it to the caller to log */
return r;
r = find_xbootldr_and_warn(override_xbootldr_path, /* unprivileged_mode= */ false, &xbootldr_where, NULL, &xbootldr_devid);
r = find_xbootldr_and_warn(NULL, override_xbootldr_path, /* unprivileged_mode= */ false, &xbootldr_where, NULL, &xbootldr_devid);
if (r < 0 && r != -ENOKEY)
return r; /* It's fine if the XBOOTLDR partition doesn't exist, hence we ignore ENOKEY here */