]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: let's emphasize a bit that halt/poweroff/reboot/shutdown are compat commands
authorLennart Poettering <lennart@poettering.net>
Thu, 15 Jun 2023 08:40:31 +0000 (10:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 15 Jun 2023 12:06:37 +0000 (14:06 +0200)
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 a9c3cc8db02dc36d41b17d0bbf1e02500046e4ce 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.

src/systemctl/systemctl-compat-halt.c
src/systemctl/systemctl-compat-shutdown.c

index b9164c27abd4d311f03c42e0dcd3cd39851f376e..4f6e30481678cfd4445f74e0221f6ef9422e6ce0 100644 (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;
index 9d39e362eae54a434ec48745071bd7a2554f06ff..881d00e0a42e039a063082ef991eba8a1318d999 100644 (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;