1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00

bootctl: show 'Default Boot Entry' header only when we found something

This commit is contained in:
Lennart Poettering 2018-06-22 19:32:49 +02:00
parent f91ed3dc81
commit a099e0352c

View File

@ -264,21 +264,20 @@ static int status_variables(void) {
}
static int status_entries(const char *esp_path, sd_id128_t partition) {
int r;
_cleanup_(boot_config_free) BootConfig config = {};
printf("Default Boot Entry:\n");
int r;
r = boot_entries_load_config(esp_path, &config);
if (r < 0)
return r;
if (config.default_entry < 0)
printf("%zu entries, no entry suitable as default\n", config.n_entries);
printf("%zu entries, no entry could be determined as default.\n", config.n_entries);
else {
const BootEntry *e = &config.entries[config.default_entry];
printf("Default Boot Entry:\n");
printf(" title: %s\n", boot_entry_title(e));
if (e->version)
printf(" version: %s\n", e->version);