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.
This commit is contained in:
Mike Yuan 2022-11-24 02:39:15 +08:00 committed by Zbigniew Jędrzejewski-Szmek
parent f8cf3d19d2
commit 3185360980
3 changed files with 8 additions and 14 deletions

5
NEWS
View file

@ -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:

View 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;
}

View 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 },