summaryrefslogtreecommitdiffstats
path: root/src/shared/bootspec.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-11-16 12:55:35 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2022-11-22 01:40:20 +0100
commit5a65d2e53531f99ee03b576bee3464775d000f48 (patch)
tree6c041b3d8d9c4659b93d3da76245c56110ea43a8 /src/shared/bootspec.c
parentudev: make sure auto-root logic also works in UKIs booted from XBOOTLDR (diff)
downloadsystemd-5a65d2e53531f99ee03b576bee3464775d000f48.tar.xz
systemd-5a65d2e53531f99ee03b576bee3464775d000f48.zip
bootctl: use grey-and-slash prefix for source in list too
Follow-up for 7851732262ec94f50598c4a289589a6ddb97ebfd. The source field also shows a path relative to $BOOT, so it should be displayed in the same fashion.
Diffstat (limited to 'src/shared/bootspec.c')
-rw-r--r--src/shared/bootspec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
index 3dec5439dd..789b89ea93 100644
--- a/src/shared/bootspec.c
+++ b/src/shared/bootspec.c
@@ -1323,14 +1323,21 @@ int show_boot_entry(
if (e->id)
printf(" id: %s\n", e->id);
if (e->path) {
- _cleanup_free_ char *link = NULL;
+ _cleanup_free_ char *text = NULL, *link = NULL;
+
+ const char *p = e->root ? path_startswith(e->path, e->root) : NULL;
+ if (p) {
+ text = strjoin(ansi_grey(), e->root, "/", ansi_normal(), "/", p);
+ if (!text)
+ return log_oom();
+ }
/* Let's urlify the link to make it easy to view in an editor, but only if it is a text
* file. Unified images are binary ELFs, and EFI variables are not pure text either. */
if (e->type == BOOT_ENTRY_CONF)
- (void) terminal_urlify_path(e->path, NULL, &link);
+ (void) terminal_urlify_path(e->path, text, &link);
- printf(" source: %s\n", link ?: e->path);
+ printf(" source: %s\n", link ?: text ?: e->path);
}
if (e->tries_left != UINT_MAX) {
printf(" tries: %u left", e->tries_left);