mirror of
https://github.com/systemd/systemd
synced 2025-10-06 00:13:24 +02:00
firstboot: show blue "chrome" bar at top
This commit is contained in:
@@ -344,6 +344,16 @@
|
||||
<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>
|
||||
|
@@ -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. */
|
||||
|
@@ -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) */
|
||||
|
Reference in New Issue
Block a user