]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homectl: show blue 'chrome' bar in first boot mode
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Sep 2025 08:18:29 +0000 (10:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Sep 2025 14:19:43 +0000 (16:19 +0200)
man/homectl.xml
src/home/homectl.c

index d57001ab03abe8cbfcff7fb40cecb0f5548767ea..961266aea3d32ac673a30495ef1e38b2a07f7465 100644 (file)
         <xi:include href="version-info.xml" xpointer="v259"/></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><option>--chrome=</option></term>
+
+        <listitem><para>Takes a boolean argument. By default the interactive user creation via
+        <command>firstboot --prompt-new-user</command> screen 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>
+
       <varlistentry>
         <term><option>--match=</option></term>
         <term><option>-A</option></term>
index 69771972d0d78f2157c87fc5c027a0591a76dec9..22665eae45fc8d8f07bd217085490483811cf786 100644 (file)
@@ -49,6 +49,7 @@
 #include "pretty-print.h"
 #include "proc-cmdline.h"
 #include "process-util.h"
+#include "prompt-util.h"
 #include "recurse-dir.h"
 #include "rlimit-util.h"
 #include "runtime-scope.h"
@@ -110,6 +111,7 @@ static bool arg_seize = true;
 static bool arg_prompt_new_user = false;
 static bool arg_prompt_shell = true;
 static bool arg_prompt_groups = true;
+static bool arg_chrome = true;
 
 STATIC_DESTRUCTOR_REGISTER(arg_identity_extra, sd_json_variant_unrefp);
 STATIC_DESTRUCTOR_REGISTER(arg_identity_extra_this_machine, sd_json_variant_unrefp);
@@ -2837,7 +2839,13 @@ static int create_interactively(void) {
                 return 0;
         }
 
-        putchar('\n');
+        (void) terminal_reset_defensive_locked(STDOUT_FILENO, /* flags= */ 0);
+
+        if (arg_chrome)
+                chrome_show("Create a User Account", /* bottom= */ NULL);
+
+        DEFER_VOID_CALL(chrome_hide);
+
         if (emoji_enabled()) {
                 fputs(glyph(GLYPH_HOME), stdout);
                 putchar(' ');
@@ -2849,8 +2857,6 @@ static int create_interactively(void) {
                 return 0;
         }
 
-        (void) terminal_reset_defensive_locked(STDOUT_FILENO, /* flags= */ 0);
-
         for (;;) {
                 username = mfree(username);
 
@@ -3069,6 +3075,8 @@ static int help(int argc, char *argv[], void *userdata) {
                "     --prompt-groups=no        In first-boot mode, don't prompt for auxiliary\n"
                "                               group memberships\n"
                "     --prompt-shell=no         In first-boot mode, don't prompt for shells\n"
+               "     --chrome=no               In first-boot mode, don't show colour bar at top\n"
+               "                               and bottom of terminal\n"
                "\n%4$sGeneral User Record Properties:%5$s\n"
                "  -c --real-name=REALNAME      Real name for user\n"
                "     --realm=REALM             Realm to create user in\n"
@@ -3307,6 +3315,7 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_MATCH,
                 ARG_PROMPT_SHELL,
                 ARG_PROMPT_GROUPS,
+                ARG_CHROME,
         };
 
         static const struct option options[] = {
@@ -3415,6 +3424,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "match",                        required_argument, NULL, ARG_MATCH                       },
                 { "prompt-shell",                 required_argument, NULL, ARG_PROMPT_SHELL                },
                 { "prompt-groups",                required_argument, NULL, ARG_PROMPT_GROUPS               },
+                { "chrome",                       required_argument, NULL, ARG_CHROME                      },
                 {}
         };
 
@@ -4988,6 +4998,13 @@ static int parse_argv(int argc, char *argv[]) {
 
                         break;
 
+                case ARG_CHROME:
+                        r = parse_boolean_argument("--chrome=", optarg, &arg_chrome);
+                        if (r < 0)
+                                return r;
+
+                        break;
+
                 case '?':
                         return -EINVAL;