systemctl: restore "systemctl reboot ARG" functionality
authorVesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
Sat, 9 Mar 2019 20:30:45 +0000 (22:30 +0200)
committerMichael Biebl <biebl@debian.org>
Thu, 18 Mar 2021 19:59:14 +0000 (19:59 +0000)
commitbeaf4957e624cb80a2557236afbb156d304c3bda
treeeea1beebc7794ff22a4d9e4c1ff947da37f0f8c6
parenta56797ea05baf0a1c88e4152ac34044e4e956d57
systemctl: restore "systemctl reboot ARG" functionality

Commit d85515edcf9700dc068201ab9f7103f04f3b25b2 changed logic how reboot is
executed. That commit changed behavior to use emergency action reboot code path
to perform the reboot.

This inadvertently broke rebooting with argument:
$ systemctl reboot custom-reason

Restore original behavior so that if reboot service unit similar to
systemd-reboot.service is executed it is possible to override reboot reason
with "systemctl reboot ARG".

When "systemctl reboot ARG" is executed ARG is placed in file
/run/systemd/reboot-param and reboot is issued using logind's Reboot
dbus-service.

If RebootArgument is specified in systemd-reboot.service it takes precedence
over what systemctl sets.

Fixes: #11828
(cherry picked from commit 77defcf5382a557189350f928967d676510e362c)

Gbp-Pq: Name systemctl-restore-systemctl-reboot-ARG-functionality.patch
src/core/emergency-action.c
src/shared/reboot-util.c
src/shared/reboot-util.h
src/systemctl/systemctl.c