]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: rework Boot Loader Entries section in status
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 May 2025 13:03:35 +0000 (15:03 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 May 2025 16:20:28 +0000 (18:20 +0200)
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

src/bootctl/bootctl-status.c

index 1804558bf7da7d0b8647cee4218f0ee517494f25..0fc86acc841f04c7f141ff542014a00f7a94d048 100644 (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");