homectl: show blue 'chrome' bar in first boot mode

This commit is contained in:
Lennart Poettering
2025-09-19 10:18:29 +02:00
parent 6d40d0773c
commit b128c31f46
2 changed files with 31 additions and 3 deletions

View File

@@ -234,6 +234,17 @@
<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>

View 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;