firstboot: welcome user with emoji in firstboot wizard 🧙

This commit is contained in:
Lennart Poettering
2025-03-14 15:44:31 +01:00
committed by Yu Watanabe
parent 3a15daf440
commit d810815ed4
5 changed files with 19 additions and 4 deletions

View File

@@ -82,6 +82,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
[SPECIAL_GLYPH_GREEN_CIRCLE] = "o",
[SPECIAL_GLYPH_SUPERHERO] = "S",
[SPECIAL_GLYPH_IDCARD] = "@",
[SPECIAL_GLYPH_HOME] = "^",
},
/* UTF-8 */
@@ -153,6 +154,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
[SPECIAL_GLYPH_GREEN_CIRCLE] = u8"🟢",
[SPECIAL_GLYPH_SUPERHERO] = u8"🦸",
[SPECIAL_GLYPH_IDCARD] = u8"🪪",
[SPECIAL_GLYPH_HOME] = u8"🏠",
},
};

View File

@@ -57,6 +57,7 @@ typedef enum SpecialGlyph {
SPECIAL_GLYPH_GREEN_CIRCLE,
SPECIAL_GLYPH_SUPERHERO,
SPECIAL_GLYPH_IDCARD,
SPECIAL_GLYPH_HOME,
_SPECIAL_GLYPH_MAX,
_SPECIAL_GLYPH_INVALID = -EINVAL,
} SpecialGlyph;

View File

@@ -124,11 +124,17 @@ static void print_welcome(int rfd) {
(void) terminal_reset_defensive_locked(STDOUT_FILENO, /* flags= */ 0);
if (colors_enabled())
printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ac, pn);
printf("\n"
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("\nPlease configure your system!\n");
putchar('\n');
if (emoji_enabled()) {
fputs(special_glyph(SPECIAL_GLYPH_SPARKLES), stdout);
putchar(' ');
}
printf("Please configure your new system!\n");
any_key_to_proceed();

View File

@@ -2710,7 +2710,12 @@ static int create_interactively(void) {
return 0;
}
printf("\nPlease create your user account!\n");
putchar('\n');
if (emoji_enabled()) {
fputs(special_glyph(SPECIAL_GLYPH_HOME), stdout);
putchar(' ');
}
printf("Please create your user account!\n");
if (!any_key_to_proceed()) {
log_notice("Skipping.");

View File

@@ -82,7 +82,7 @@ TEST(keymaps) {
#define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
TEST(dump_special_glyphs) {
assert_cc(SPECIAL_GLYPH_IDCARD + 1 == _SPECIAL_GLYPH_MAX);
assert_cc(SPECIAL_GLYPH_HOME + 1 == _SPECIAL_GLYPH_MAX);
log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
@@ -135,6 +135,7 @@ TEST(dump_special_glyphs) {
dump_glyph(SPECIAL_GLYPH_GREEN_CIRCLE);
dump_glyph(SPECIAL_GLYPH_SUPERHERO);
dump_glyph(SPECIAL_GLYPH_IDCARD);
dump_glyph(SPECIAL_GLYPH_HOME);
}
DEFINE_TEST_MAIN(LOG_INFO);