bootctl: rework Boot Loader Entries section in status

Kernels are loaded from two partitions (XBOOTLDR and ESP). In the past this
wasn't always so, but a while ago the docs and the code were updated to load
from both locations. The $BOOT location specifies where to install only. So
rework the status output to print both locations and indicate which one is
$BOOT by appending ", $BOOT".

Also change the section title to "… Locations". We don't show *entries* here,
so the old title could be a bit confusing.

Example:
Boot Loader Entry Locations:
          ESP: /efi (/dev/disk/by-partuuid/31659406-5a17-46ec-8195-0dea1667db58)
     XBOOTLDR: /boot (/dev/disk/by-partuuid/4f8a8fe9-4b45-4070-9e9b-a681be51c902, $BOOT)
        token: fedora
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-05-20 15:03:35 +02:00
parent 6479204e56
commit e187450648

View File

@@ -63,26 +63,31 @@ static int status_entries(
const char *xbootldr_path,
sd_id128_t xbootldr_partition_uuid) {
sd_id128_t dollar_boot_partition_uuid;
const char *dollar_boot_path;
int r;
assert(config);
assert(esp_path || xbootldr_path);
printf("%sBoot Loader Entry Locations:%s\n", ansi_underline(), ansi_normal());
printf(" ESP: %s (", esp_path);
if (!sd_id128_is_null(esp_partition_uuid))
printf("/dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR "",
SD_ID128_FORMAT_VAL(esp_partition_uuid));
if (!xbootldr_path)
/* ESP is $BOOT if XBOOTLDR not present. */
printf(", %s$BOOT%s", ansi_green(), ansi_normal());
printf(")");
if (xbootldr_path) {
dollar_boot_path = xbootldr_path;
dollar_boot_partition_uuid = xbootldr_partition_uuid;
} else {
dollar_boot_path = esp_path;
dollar_boot_partition_uuid = esp_partition_uuid;
printf("\n XBOOTLDR: %s (", xbootldr_path);
if (!sd_id128_is_null(xbootldr_partition_uuid))
printf("/dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR ", ",
SD_ID128_FORMAT_VAL(xbootldr_partition_uuid));
/* XBOOTLDR is always $BOOT if present. */
printf("%s$BOOT%s)", ansi_green(), ansi_normal());
}
printf("%sBoot Loader Entries:%s\n"
" $BOOT: %s", ansi_underline(), ansi_normal(), dollar_boot_path);
if (!sd_id128_is_null(dollar_boot_partition_uuid))
printf(" (/dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR ")",
SD_ID128_FORMAT_VAL(dollar_boot_partition_uuid));
if (settle_entry_token() >= 0)
printf("\n token: %s", arg_entry_token);
printf("\n\n");