diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-05-23 17:32:49 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-05-23 17:38:43 +0200 |
commit | d0c50d8dfa7ea6721d3b83af5bbbd4d96be22085 (patch) | |
tree | 5209c98b7f61cb585ae80da72533670d8b48b0f4 /src/firstboot | |
parent | firstboot: do vconsole setup after configuring keymap (diff) | |
download | systemd-d0c50d8dfa7ea6721d3b83af5bbbd4d96be22085.tar.xz systemd-d0c50d8dfa7ea6721d3b83af5bbbd4d96be22085.zip |
firstboot: reload manager after writing /etc/locale.conf
Requested in https://github.com/systemd/systemd/pull/27750#issuecomment-1559258861.
I didn't apply the locale configuration in firstboot itself, because
we don't have any localized messages, so that wouldn't change anything.
Diffstat (limited to 'src/firstboot')
-rw-r--r-- | src/firstboot/firstboot.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 4d14aa75e1..c423aff5dd 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -448,7 +448,7 @@ static int process_locale(int rfd) { return log_error_errno(r, "Failed to write /etc/locale.conf: %m"); log_info("/etc/locale.conf written."); - return 0; + return 1; } static int prompt_keymap(int rfd) { @@ -1567,6 +1567,25 @@ static int parse_argv(int argc, char *argv[]) { return 1; } +static int reload_system_manager(sd_bus **bus) { + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; + int r; + + assert(bus); + + if (!*bus) { + r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, RUNTIME_SCOPE_SYSTEM, bus); + if (r < 0) + return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL); + } + + r = bus_call_method(*bus, bus_systemd_mgr, "Reload", &error, NULL, NULL); + if (r < 0) + return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, r)); + log_info("Requested manager reload to apply locale configuration."); + return 0; +} + static int reload_vconsole(sd_bus **bus) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; int r; @@ -1668,6 +1687,8 @@ static int run(int argc, char *argv[]) { r = process_locale(rfd); if (r < 0) return r; + if (r > 0 && !offline) + (void) reload_system_manager(&bus); r = process_keymap(rfd); if (r < 0) |