bootctl: show more information about boot entry state in list
Let's improve display of boot entries and show what type they have (i.e. boot loader spec type 1, or type 2, or auto-discovered or reported by boot loader), and in particular mark entries the boot loader discovered but we can't find (i.e. that likely vanished, or possibly couldn't be found due to a misconfiguration) and that the boot loader didn't find but we see (which are new, or possibly also the result of misconfiguraiton). This is supposed to be a replacement for #22161, but instead of hiding vanished entries, highlights them, which I think is more appropriate for a low-level tool such bootctl. Replaces: #22161 #22398
This commit is contained in:
@@ -561,7 +561,7 @@ static int boot_entries_find_unified(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool find_nonunique(BootEntry *entries, size_t n_entries, bool *arr) {
|
||||
static bool find_nonunique(const BootEntry *entries, size_t n_entries, bool arr[]) {
|
||||
size_t i, j;
|
||||
bool non_unique = false;
|
||||
|
||||
@@ -833,11 +833,15 @@ int boot_entries_augment_from_loader(
|
||||
* already included there. */
|
||||
|
||||
STRV_FOREACH(i, found_by_loader) {
|
||||
BootEntry *existing;
|
||||
_cleanup_free_ char *c = NULL, *t = NULL, *p = NULL;
|
||||
char **a, **b;
|
||||
|
||||
if (boot_config_has_entry(config, *i))
|
||||
existing = boot_config_find_entry(config, *i);
|
||||
if (existing) {
|
||||
existing->reported_by_loader = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (only_auto && !startswith(*i, "auto-"))
|
||||
continue;
|
||||
@@ -862,10 +866,11 @@ int boot_entries_augment_from_loader(
|
||||
return log_oom();
|
||||
|
||||
config->entries[config->n_entries++] = (BootEntry) {
|
||||
.type = BOOT_ENTRY_LOADER,
|
||||
.type = startswith(*i, "auto-") ? BOOT_ENTRY_LOADER_AUTO : BOOT_ENTRY_LOADER,
|
||||
.id = TAKE_PTR(c),
|
||||
.title = TAKE_PTR(t),
|
||||
.path = TAKE_PTR(p),
|
||||
.reported_by_loader = true,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user