From: Mike Yuan Date: Wed, 23 Nov 2022 18:39:15 +0000 (+0800) Subject: systemctl: deprecate passing positional argument to reboot completely X-Git-Tag: v253-rc1~437 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31853609809c67a2f8a8beb0436378e9bfb9a54d;p=thirdparty%2Fsystemd.git systemctl: deprecate passing positional argument to reboot completely (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. --- diff --git a/NEWS b/NEWS index db5d84c47db..a295a8ebe2a 100644 --- 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: diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c index 9363764cd70..edc907c832d 100644 --- a/src/systemctl/systemctl-start-special.c +++ b/src/systemctl/systemctl-start-special.c @@ -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; } diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 3f28bcc3dc9..4f2637f0f1e 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -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 },