From: David Härdeman Date: Thu, 21 Nov 2024 19:24:06 +0000 (+0100) Subject: logind: allow wall messages to be controlled via config file X-Git-Tag: v258-rc1~1862 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=130698dc20df9438c3f5b79ddf2c1a1b16c3f8fc;p=thirdparty%2Fsystemd.git logind: allow wall messages to be controlled via config file Right now, the sending of wall messages on reboot/shutdown/etc can be controlled via DBus properties. This patch adds support for changing the default via the logind.conf file as well. Note that the DBus setting is lost if logind is restarted or reloaded, but it was already the case before this patch that the setting is lost upon restart. --- diff --git a/man/logind.conf.xml b/man/logind.conf.xml index 66240b58fe8..da41d56e7fa 100644 --- a/man/logind.conf.xml +++ b/man/logind.conf.xml @@ -409,6 +409,21 @@ + + + EnableWallMessages= + + + + Controls whether + wall1 + messages should be sent to the terminals of all currently logged in users upon shutdown or + reboot. Defaults to yes, and can be changed at runtime via the DBus + EnableWallMessages and WallMessagePrefix properties. + + + + diff --git a/src/login/logind-core.c b/src/login/logind-core.c index a1c0069f691..719aeef0175 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -39,6 +39,7 @@ void manager_reset_config(Manager *m) { m->remove_ipc = true; m->inhibit_delay_max = 5 * USEC_PER_SEC; m->user_stop_delay = 10 * USEC_PER_SEC; + m->enable_wall_messages = true; m->handle_action_sleep_mask = HANDLE_ACTION_SLEEP_MASK_DEFAULT; diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf index ce5af2ccfa7..e7f39fed2a9 100644 --- a/src/login/logind-gperf.gperf +++ b/src/login/logind-gperf.gperf @@ -54,3 +54,4 @@ Login.SessionsMax, config_parse_uint64, 0, offse Login.DesignatedMaintenanceTime, config_parse_calendar, 0, offsetof(Manager, maintenance_time) Login.UserTasksMax, config_parse_compat_user_tasks_max, 0, 0 Login.StopIdleSessionSec, config_parse_sec_fix_0, 0, offsetof(Manager, stop_idle_session_usec) +Login.EnableWallMessages, config_parse_bool, 0, offsetof(Manager, enable_wall_messages) diff --git a/src/login/logind.c b/src/login/logind.c index 8dc1781edff..186778677b6 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -64,7 +64,6 @@ static int manager_new(Manager **ret) { *m = (Manager) { .console_active_fd = -EBADF, .reserve_vt_fd = -EBADF, - .enable_wall_messages = true, .idle_action_not_before_usec = now(CLOCK_MONOTONIC), .scheduled_shutdown_action = _HANDLE_ACTION_INVALID, diff --git a/src/login/logind.conf.in b/src/login/logind.conf.in index 2e06b9a0501..8adf4393c7e 100644 --- a/src/login/logind.conf.in +++ b/src/login/logind.conf.in @@ -52,3 +52,4 @@ #SessionsMax=8192 #StopIdleSessionSec=infinity #DesignatedMaintenanceTime= +#EnableWallMessages=yes