systemd/0231-bootctl-suppress-output-of-empty-partition-info-if-w.patch
Jan Macku eb5b3a87a8 systemd-257-8
Resolves: RHEL-71409, RHEL-75774
2025-02-14 10:09:33 +01:00

54 lines
2.6 KiB
Diff

From 5f631785cc2dc16bd85566f901cc474417fc0856 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sun, 9 Feb 2025 23:23:38 +0100
Subject: [PATCH] bootctl: suppress output of empty partition info if we also
have no idea about EFI binary path
So far we'd output both the partition and the binary path always, even
if we didn't know either (but in that case show empty information).
Let's address this, and show partition info only if we know it, or if we
know the EFI binary path, but suppress both if we know neither.
Note that we'll show the partition info if we don't know it still if we
know the EFI binary path used for boot, since it is relative to the
partition of course, and hence it's really strange to know one but not
the other, hence it deserves some mentioning in the output.
(cherry picked from commit df418fa234a5b12e302a336df82c97f33871ae35)
---
src/bootctl/bootctl-status.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/bootctl/bootctl-status.c b/src/bootctl/bootctl-status.c
index 9a4c233581..25c9f66a22 100644
--- a/src/bootctl/bootctl-status.c
+++ b/src/bootctl/bootctl-status.c
@@ -494,9 +494,11 @@ int verb_status(int argc, char *argv[], void *userdata) {
printf(" Partition: /dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR "\n",
SD_ID128_FORMAT_VAL(loader_partition_uuid));
- } else
+ } else if (loader_path)
printf(" Partition: n/a\n");
- printf(" Loader: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), strna(loader_path));
+
+ if (loader_path)
+ printf(" Loader: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), strna(loader_path));
printf("\n");
}
@@ -518,9 +520,11 @@ int verb_status(int argc, char *argv[], void *userdata) {
printf(" Partition: /dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR "\n",
SD_ID128_FORMAT_VAL(stub_partition_uuid));
- } else
+ } else if (stub_path)
printf(" Partition: n/a\n");
- printf(" Stub: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), strna(stub_path));
+
+ if (stub_path)
+ printf(" Stub: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), strna(stub_path));
printf("\n");
}