summaryrefslogtreecommitdiffstats
path: root/src/nspawn
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-01-19 23:23:48 +0100
committerLennart Poettering <lennart@poettering.net>2024-01-22 16:24:00 +0100
commit1807baa931e4afa6d0c61fb9582f6529b25189eb (patch)
tree71e6bb0389a18f4e43472e5e08976ddc6da44c89 /src/nspawn
parentvmspawn: make "-m" value formatting independent of locale (diff)
downloadsystemd-1807baa931e4afa6d0c61fb9582f6529b25189eb.tar.xz
systemd-1807baa931e4afa6d0c61fb9582f6529b25189eb.zip
nspawn,vmspawn: let's add some terminal magic to the welcome text
Let's grey the text out, and prefix it with a vertical grey bar, to make clear this is output from the host, not the payload, and make it clearly distinguishable from what follows. Let's also make the image name clickable (with new enough shared-mime-info this should allow you to look into the image with gnome-disk-utility or a similar tool.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 445d85da6f..c48b51323b 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -5943,9 +5943,16 @@ static int run(int argc, char *argv[]) {
if (arg_console_mode == CONSOLE_PIPE) /* if we pass STDERR on to the container, don't add our own logs into it too */
arg_quiet = true;
- if (!arg_quiet)
- log_info("Spawning container %s on %s.\nPress Ctrl-] three times within 1s to kill container.",
- arg_machine, arg_image ?: arg_directory);
+ if (!arg_quiet) {
+ const char *t = arg_image ?: arg_directory;
+ _cleanup_free_ char *u = NULL;
+ (void) terminal_urlify_path(t, t, &u);
+
+ log_info("%s %sSpawning container %s on %s.%s\n"
+ "%s %sPress %sCtrl-]%s three times within 1s to kill container.%s",
+ special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), arg_machine, u ?: t, ansi_normal(),
+ special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), ansi_highlight(), ansi_grey(), ansi_normal());
+ }
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, SIGRTMIN+18, -1) >= 0);