diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-26 22:24:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-29 15:40:01 +0200 |
commit | d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10 (patch) | |
tree | 84c43110e31609b9f9cf9313bc2ba4bc9bcb91ec /src/boot/bootctl.c | |
parent | README: add a Fossies codespell badge (diff) | |
download | systemd-d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10.tar.xz systemd-d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10.zip |
efi: cache LoaderEntries EFI variable
Based-on:
https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
Diffstat (limited to 'src/boot/bootctl.c')
-rw-r--r-- | src/boot/bootctl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index a197668ce9..ab145d65f5 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1311,6 +1311,7 @@ static int verb_status(int argc, char *argv[], void *userdata) { static int verb_list(int argc, char *argv[], void *userdata) { _cleanup_(boot_config_free) BootConfig config = {}; + _cleanup_strv_free_ char **efi_entries = NULL; int r; /* If we lack privileges we invoke find_esp_and_warn() in "unprivileged mode" here, which does two things: turn @@ -1333,7 +1334,13 @@ static int verb_list(int argc, char *argv[], void *userdata) { if (r < 0) return r; - (void) boot_entries_augment_from_loader(&config, false); + r = efi_loader_get_entries(&efi_entries); + if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) + log_debug_errno(r, "Boot loader reported no entries."); + else if (r < 0) + log_warning_errno(r, "Failed to determine entries reported by boot loader, ignoring: %m"); + else + (void) boot_entries_augment_from_loader(&config, efi_entries, false); if (config.n_entries == 0) log_info("No boot loader entries found."); |