summaryrefslogtreecommitdiffstats
path: root/src/firstboot
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-12 13:52:01 +0200
committerLennart Poettering <lennart@poettering.net>2019-07-13 11:07:51 +0200
commit4aeadec7e66f59e7a7846a5e91de045564dba23b (patch)
treea8658891286c0dcb42bbd19e6f4c6acb89b8b31c /src/firstboot
parentfirstboot: suppress locale menu if there's nothing to choose from (diff)
downloadsystemd-4aeadec7e66f59e7a7846a5e91de045564dba23b.tar.xz
systemd-4aeadec7e66f59e7a7846a5e91de045564dba23b.zip
firstboot: use color in welcome text
Diffstat (limited to 'src/firstboot')
-rw-r--r--src/firstboot/firstboot.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index b60ef572cf..74b83f348b 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -87,20 +87,31 @@ static bool press_any_key(void) {
}
static void print_welcome(void) {
- _cleanup_free_ char *pretty_name = NULL;
+ _cleanup_free_ char *pretty_name = NULL, *ansi_color = NULL;
static bool done = false;
+ const char *pn;
int r;
if (done)
return;
- r = parse_os_release(arg_root, "PRETTY_NAME", &pretty_name, NULL);
+ r = parse_os_release(
+ arg_root,
+ "PRETTY_NAME", &pretty_name,
+ "ANSI_COLOR", &ansi_color,
+ NULL);
if (r < 0)
log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
"Failed to read os-release file, ignoring: %m");
- printf("\nWelcome to your new installation of %s!\nPlease configure a few basic system settings:\n\n",
- isempty(pretty_name) ? "Linux" : pretty_name);
+ pn = isempty(pretty_name) ? "Linux" : pretty_name;
+
+ if (colors_enabled())
+ printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ansi_color, pn);
+ else
+ printf("\nWelcome to your new installation of %s!\n", pn);
+
+ printf("\nPlease configure your system!\n\n");
press_any_key();