systemctl: let's emphasize a bit that halt/poweroff/reboot/shutdown are compat commands

Let's try to make clear that these calls really should not be extended
anymore, but remain as the compat glue they are but not more.

Anything new should really be added to systemctl poweroff/halt/reboot,
which is actually defined and owned by us.

This is added in light of a9c3cc8db0 which
really shouldn't have been added I am sure.

This adds two things: a note to the --help text that people use the
relevant systemctl commands instead (as they are a lot more powerful,
for example give you inhibitor and boot loader control, kexec, and so
on). And a note to developers that they stop adding new stuff to the
compat interfaces.
This commit is contained in:
Lennart Poettering 2023-06-15 10:40:31 +02:00
parent c4ffb53054
commit 6e89663d23
2 changed files with 21 additions and 7 deletions

View file

@ -26,6 +26,11 @@ static int halt_help(void) {
if (r < 0)
return log_oom();
/* Note: if you are tempted to add new command line switches here, please do not. Let this
* compatibility command rest in peace. Its interface is not even owned by us as much as it is by
* sysvinit. If you add something new, add it to "systemctl halt", "systemctl reboot", "systemctl
* poweroff" instead. */
printf("%s [OPTIONS...]%s\n"
"\n%s%s the system.%s\n"
"\nOptions:\n"
@ -37,14 +42,16 @@ static int halt_help(void) {
" -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record\n"
" -d --no-wtmp Don't write wtmp record\n"
" --no-wall Don't send wall message before halt/power-off/reboot\n"
"\n%sThis is a compatibility interface, please use the more powerful 'systemctl %s' command instead.%s\n"
"\nSee the %s for details.\n",
program_invocation_short_name,
arg_action == ACTION_REBOOT ? " [ARG]" : "",
ansi_highlight(),
arg_action == ACTION_REBOOT ? "Reboot" :
arg_action == ACTION_POWEROFF ? "Power off" :
"Halt",
ansi_normal(),
ansi_highlight(), arg_action == ACTION_REBOOT ? "Reboot" :
arg_action == ACTION_POWEROFF ? "Power off" :
"Halt", ansi_normal(),
ansi_highlight_red(), arg_action == ACTION_REBOOT ? "reboot" :
arg_action == ACTION_POWEROFF ? "poweroff" :
"halt", ansi_normal(),
link);
return 0;

View file

@ -18,6 +18,11 @@ static int shutdown_help(void) {
if (r < 0)
return log_oom();
/* Note: if you are tempted to add new command line switches here, please do not. Let this
* compatibility command rest in peace. Its interface is not even owned by us as much as it is by
* sysvinit. If you add something new, add it to "systemctl halt", "systemctl reboot", "systemctl
* poweroff" instead. */
printf("%s [OPTIONS...] [TIME] [WALL...]\n"
"\n%sShut down the system.%s\n"
"\nOptions:\n"
@ -30,10 +35,12 @@ static int shutdown_help(void) {
" --no-wall Don't send wall message before halt/power-off/reboot\n"
" -c Cancel a pending shutdown\n"
" --show Show pending shutdown\n"
"\n%sThis is a compatibility interface, please use the more powerful 'systemctl reboot',\n"
"'systemctl poweroff', 'systemctl reboot' commands instead.%s\n"
"\nSee the %s for details.\n",
program_invocation_short_name,
ansi_highlight(),
ansi_normal(),
ansi_highlight(), ansi_normal(),
ansi_highlight_red(), ansi_normal(),
link);
return 0;