summaryrefslogtreecommitdiffstats
path: root/src/systemctl/systemctl-start-special.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-04-23 10:14:41 +0200
committerLennart Poettering <lennart@poettering.net>2024-04-23 11:04:08 +0200
commitc65bd6cc7eb000fa3a40ebb33718752ac259629c (patch)
treebc97e5c1d03f9e7815ee93eb975c12315a0407a0 /src/systemctl/systemctl-start-special.c
parentshutdown: send an sd_notify() message on shutdown with the shutdown reason an... (diff)
downloadsystemd-c65bd6cc7eb000fa3a40ebb33718752ac259629c.tar.xz
systemd-c65bd6cc7eb000fa3a40ebb33718752ac259629c.zip
systemctl: set reboot argument for most forms of shutdown, not just plain reboots
This doesn't hurt anyway, and is useful now that we propagate the string via sd_notify() too.
Diffstat (limited to 'src/systemctl/systemctl-start-special.c')
-rw-r--r--src/systemctl/systemctl-start-special.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c
index d486b406da..4b99d0c629 100644
--- a/src/systemctl/systemctl-start-special.c
+++ b/src/systemctl/systemctl-start-special.c
@@ -155,14 +155,16 @@ int verb_start_special(int argc, char *argv[], void *userdata) {
return r;
}
- if (a == ACTION_REBOOT) {
- if (arg_reboot_argument) {
- r = update_reboot_parameter_and_warn(arg_reboot_argument, false);
- if (r < 0)
- return r;
- }
+ if (arg_reboot_argument && IN_SET(a, ACTION_HALT, ACTION_POWEROFF, ACTION_REBOOT, ACTION_KEXEC)) {
+ /* If we are going through an action that involves systemd-shutdown, let's set the reboot
+ * parameter, even if it's not a regular reboot. After all we nowadays send the string to
+ * our supervisor via sd_notify() too. */
+ r = update_reboot_parameter_and_warn(arg_reboot_argument, /* keep= */ false);
+ if (r < 0)
+ return r;
+ }
- } else if (a == ACTION_KEXEC) {
+ if (a == ACTION_KEXEC) {
r = load_kexec_kernel();
if (r < 0 && arg_force >= 1)
log_notice("Failed to load kexec kernel, continuing without.");