]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: deprecate passing positional argument to reboot completely
authorMike Yuan <me@yhndnzj.com>
Wed, 23 Nov 2022 18:39:15 +0000 (02:39 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 27 Nov 2022 10:18:32 +0000 (11:18 +0100)
(follow-up of #15958)

In #15958 we deprecated passing positional argument to reboot by
generate a warning. It's been two years now and I believe it can
be dropped completely, as per requested in #15773.

NEWS
src/systemctl/systemctl-start-special.c
src/systemctl/systemctl.c

diff --git a/NEWS b/NEWS
index db5d84c47dbf933d128c2bb4a2556d2cc2ec8d72..a295a8ebe2accff4c83cd39a093b131e6017a198 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,11 @@ CHANGES WITH 253 in spe:
          virtualized ones, and is activated in the case that the system token
          is missing from either sd-boot and sd-stub booted systems.
 
+        Changes in systemctl:
+
+    * systemctl reboot has dropped support for accepting a positional argument
+      as the argument to reboot(2) syscall. Please use --reboot-argument instead.
+
 CHANGES WITH 252 🎃:
 
         Announcements of Future Feature Removals:
index 9363764cd70e6e7d256beddbfe9e5b01667a5f5e..edc907c832d4634ad305dfbfa1d5898070d474d5 100644 (file)
@@ -153,19 +153,8 @@ int verb_start_special(int argc, char *argv[], void *userdata) {
                 return r;
 
         if (a == ACTION_REBOOT) {
-                const char *arg = NULL;
-
-                if (argc > 1) {
-                        if (arg_reboot_argument)
-                                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Both --reboot-argument= and positional argument passed to reboot command, refusing.");
-
-                        log_notice("Positional argument to reboot command is deprecated, please use --reboot-argument= instead. Accepting anyway.");
-                        arg = argv[1];
-                } else
-                        arg = arg_reboot_argument;
-
-                if (arg) {
-                        r = update_reboot_parameter_and_warn(arg, false);
+                if (arg_reboot_argument) {
+                        r = update_reboot_parameter_and_warn(arg_reboot_argument, false);
                         if (r < 0)
                                 return r;
                 }
index 3f28bcc3dc916cc326aac165290393d288850602..4f2637f0f1e44015ce3f78ce1f3be05707692383 100644 (file)
@@ -1087,7 +1087,7 @@ static int systemctl_main(int argc, char *argv[]) {
                 { "import-environment",    VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_import_environment      },
                 { "halt",                  VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },
                 { "poweroff",              VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },
-                { "reboot",                VERB_ANY, 2,        VERB_ONLINE_ONLY, verb_start_system_special    },
+                { "reboot",                VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },
                 { "kexec",                 VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },
                 { "suspend",               VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },
                 { "hibernate",             VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_start_system_special    },