summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-11-12 14:18:31 +0100
committerLennart Poettering <lennart@poettering.net>2024-11-12 23:09:21 +0100
commitc892816ceb19378f5079eee37d89f18e5c202447 (patch)
tree9ddada5d3f3ae2a8dfc374f10c3939a1236327f6
parentdbus-manager: add missing word 'unit' to PK message (diff)
downloadsystemd-c892816ceb19378f5079eee37d89f18e5c202447.tar.xz
systemd-c892816ceb19378f5079eee37d89f18e5c202447.zip
run0: when changing privileges to non-root, do not show superhero emoji
Let's show an idcard logo instead, to indicate that we changed ids.
-rw-r--r--src/basic/glyph-util.c2
-rw-r--r--src/basic/glyph-util.h1
-rw-r--r--src/run/run.c2
-rw-r--r--src/test/test-locale-util.c3
4 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/glyph-util.c b/src/basic/glyph-util.c
index 1108afdf03..64f6685cb4 100644
--- a/src/basic/glyph-util.c
+++ b/src/basic/glyph-util.c
@@ -81,6 +81,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
[SPECIAL_GLYPH_BLUE_CIRCLE] = "o",
[SPECIAL_GLYPH_GREEN_CIRCLE] = "o",
[SPECIAL_GLYPH_SUPERHERO] = "S",
+ [SPECIAL_GLYPH_IDCARD] = "@",
},
/* UTF-8 */
@@ -151,6 +152,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
[SPECIAL_GLYPH_BLUE_CIRCLE] = u8"🔵",
[SPECIAL_GLYPH_GREEN_CIRCLE] = u8"🟢",
[SPECIAL_GLYPH_SUPERHERO] = u8"🦸",
+ [SPECIAL_GLYPH_IDCARD] = u8"🪪",
},
};
diff --git a/src/basic/glyph-util.h b/src/basic/glyph-util.h
index c31c3c18bb..ca4d4eda71 100644
--- a/src/basic/glyph-util.h
+++ b/src/basic/glyph-util.h
@@ -56,6 +56,7 @@ typedef enum SpecialGlyph {
SPECIAL_GLYPH_BLUE_CIRCLE,
SPECIAL_GLYPH_GREEN_CIRCLE,
SPECIAL_GLYPH_SUPERHERO,
+ SPECIAL_GLYPH_IDCARD,
_SPECIAL_GLYPH_MAX,
_SPECIAL_GLYPH_INVALID = -EINVAL,
} SpecialGlyph;
diff --git a/src/run/run.c b/src/run/run.c
index 5a1df9ce8f..c62dce8950 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -1038,7 +1038,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
if (!arg_shell_prompt_prefix)
return log_oom();
} else if (emoji_enabled()) {
- arg_shell_prompt_prefix = strjoin(special_glyph(SPECIAL_GLYPH_SUPERHERO), " ");
+ arg_shell_prompt_prefix = strjoin(special_glyph(privileged_execution() ? SPECIAL_GLYPH_SUPERHERO : SPECIAL_GLYPH_IDCARD), " ");
if (!arg_shell_prompt_prefix)
return log_oom();
}
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
index 7afa446bfb..f9b2712444 100644
--- a/src/test/test-locale-util.c
+++ b/src/test/test-locale-util.c
@@ -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_SUPERHERO + 1 == _SPECIAL_GLYPH_MAX);
+ assert_cc(SPECIAL_GLYPH_IDCARD + 1 == _SPECIAL_GLYPH_MAX);
log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
@@ -134,6 +134,7 @@ TEST(dump_special_glyphs) {
dump_glyph(SPECIAL_GLYPH_BLUE_CIRCLE);
dump_glyph(SPECIAL_GLYPH_GREEN_CIRCLE);
dump_glyph(SPECIAL_GLYPH_SUPERHERO);
+ dump_glyph(SPECIAL_GLYPH_IDCARD);
}
DEFINE_TEST_MAIN(LOG_INFO);