]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
firstboot: fill empty color if ansi_color unavailable from os-release
authorafg <afg984@gmail.com>
Tue, 1 Sep 2020 21:20:25 +0000 (05:20 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Sep 2020 09:03:11 +0000 (11:03 +0200)
(cherry picked from commit ae0d36c161ef0b8bde08d37674eb500061245728)

src/firstboot/firstboot.c

index a3f442518ec43d207c8290523e2716a33f5cb1b5..c9fc8dd5cdc8e7002435165c796440e554203156 100644 (file)
@@ -94,7 +94,7 @@ static bool press_any_key(void) {
 static void print_welcome(void) {
         _cleanup_free_ char *pretty_name = NULL, *ansi_color = NULL;
         static bool done = false;
-        const char *pn;
+        const char *pn, *ac;
         int r;
 
         if (!arg_welcome)
@@ -113,9 +113,10 @@ static void print_welcome(void) {
                                "Failed to read os-release file, ignoring: %m");
 
         pn = isempty(pretty_name) ? "Linux" : pretty_name;
+        ac = isempty(ansi_color) ? "0" : ansi_color;
 
         if (colors_enabled())
-                printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ansi_color, pn);
+                printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ac, pn);
         else
                 printf("\nWelcome to your new installation of %s!\n", pn);