]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
firstboot: show blue "chrome" bar at top
authorLennart Poettering <lennart@poettering.net>
Thu, 11 Sep 2025 09:25:00 +0000 (11:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Sep 2025 13:46:30 +0000 (15:46 +0200)
man/systemd-firstboot.xml
src/firstboot/firstboot.c
src/shared/prompt-util.c

index 2af354f872c746cd56c327c8b207a2cddcab20d3..449fe4ec4a0e9b457a59c1d7da90a44efdb77e18 100644 (file)
         <xi:include href="version-info.xml" xpointer="v246"/></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><option>--chrome=</option></term>
+
+        <listitem><para>Takes a boolean argument. By default the initial setup scren will show reverse color
+        "chrome" bars at the top and and the bottom of the terminal screen, which may be disabled by setting
+        this option to false.</para>
+
+        <xi:include href="version-info.xml" xpointer="v259"/></listitem>
+      </varlistentry>
+
       <xi:include href="standard-options.xml" xpointer="help" />
       <xi:include href="standard-options.xml" xpointer="version" />
     </variablelist>
index e311cb9fa7d18560ea82d773ce05b72cde716a8b..b7b09ba8752b934641f94eefd4cb851ae3399146 100644 (file)
@@ -85,6 +85,7 @@ static bool arg_root_password_is_hashed = false;
 static bool arg_welcome = true;
 static bool arg_reset = false;
 static ImagePolicy *arg_image_policy = NULL;
+static bool arg_chrome = true;
 
 STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
 STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
@@ -114,6 +115,11 @@ static void print_welcome(int rfd) {
                 return;
         }
 
+        (void) terminal_reset_defensive_locked(STDOUT_FILENO, /* flags= */ 0);
+
+        if (arg_chrome)
+                chrome_show("Initial Setup", /* bottom= */ NULL);
+
         r = parse_os_release_at(rfd,
                                 "PRETTY_NAME", &pretty_name,
                                 "NAME", &os_name,
@@ -125,13 +131,10 @@ static void print_welcome(int rfd) {
         pn = os_release_pretty_name(pretty_name, os_name);
         ac = isempty(ansi_color) ? "0" : ansi_color;
 
-        (void) terminal_reset_defensive_locked(STDOUT_FILENO, /* flags= */ 0);
-
         if (colors_enabled())
-                printf("\n"
-                       ANSI_HIGHLIGHT "Welcome to your new installation of " ANSI_NORMAL "\x1B[%sm%s" ANSI_HIGHLIGHT "!" ANSI_NORMAL "\n", ac, pn);
+                printf(ANSI_HIGHLIGHT "Welcome to your new installation of " ANSI_NORMAL "\x1B[%sm%s" ANSI_HIGHLIGHT "!" ANSI_NORMAL "\n", ac, pn);
         else
-                printf("\nWelcome to your new installation of %s!\n", pn);
+                printf("Welcome to your new installation of %s!\n", pn);
 
         putchar('\n');
         if (emoji_enabled()) {
@@ -1241,6 +1244,8 @@ static int help(void) {
                "     --force                      Overwrite existing files\n"
                "     --delete-root-password       Delete root password\n"
                "     --welcome=no                 Disable the welcome text\n"
+               "     --chrome=no                  Don't show color bar at top and bottom of\n"
+               "                                  terminal\n"
                "     --reset                      Remove existing files\n"
                "\nSee the %s for details.\n",
                program_invocation_short_name,
@@ -1284,6 +1289,7 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_FORCE,
                 ARG_DELETE_ROOT_PASSWORD,
                 ARG_WELCOME,
+                ARG_CHROME,
                 ARG_RESET,
         };
 
@@ -1321,6 +1327,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "force",                   no_argument,       NULL, ARG_FORCE                   },
                 { "delete-root-password",    no_argument,       NULL, ARG_DELETE_ROOT_PASSWORD    },
                 { "welcome",                 required_argument, NULL, ARG_WELCOME                 },
+                { "chrome",                  required_argument, NULL, ARG_CHROME                  },
                 { "reset",                   no_argument,       NULL, ARG_RESET                   },
                 {}
         };
@@ -1530,6 +1537,13 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_welcome = r;
                         break;
 
+                case ARG_CHROME:
+                        r = parse_boolean_argument("--chrome=", optarg, &arg_chrome);
+                        if (r < 0)
+                                return r;
+
+                        break;
+
                 case ARG_RESET:
                         arg_reset = true;
                         break;
@@ -1674,6 +1688,7 @@ static int run(int argc, char *argv[]) {
         }
 
         LOG_SET_PREFIX(arg_image ?: arg_root);
+        DEFER_VOID_CALL(chrome_hide);
 
         /* We check these conditions here instead of in parse_argv() so that we can take the root directory
          * into account. */
index 5c3fa98a922e4b8b2147fa5eeaec007f72b9dc8a..927ef0770e9d7075d2c833298250a016da4621c4 100644 (file)
@@ -213,7 +213,7 @@ int chrome_show(
                 return 0;
 
         unsigned n = lines();
-        if (n < 12) /* Do not bother with the chrom on tiny screens */
+        if (n < 12) /* Do not bother with the chrome on tiny screens */
                 return 0;
 
         _cleanup_free_ char *b = NULL, *ansi_color_reverse = NULL;
@@ -317,7 +317,7 @@ void chrome_hide(void) {
         printf("\x1B[%u;1H"
                ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE "\n"
                ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE "\n"
-               ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE ANSI_NORMAL,
+               ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE,
                n - 2);
 
         /* Reset scrolling area (DECSTBM) */