]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: add new mode systemd.show-status=error and use it when 'quiet' is passed 14976/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 29 Feb 2020 16:49:50 +0000 (17:49 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 1 Mar 2020 10:48:23 +0000 (11:48 +0100)
systemd.show-status=error is useful for the case where people care about errors
only.

If people want to have a quiet boot, they most likely don't want to see all
status output even if there is a delay in boot, so make "quiet" imply
systemd.show-status=error instead of systemd.show-status=auto.

Fixes #14976.

TODO
man/systemd.xml
src/core/main.c
src/core/manager.c
src/core/show-status.c
src/core/show-status.h

diff --git a/TODO b/TODO
index d26b1be4089a4f0f383ddd36a035f6aa6705bf98..e944245a57b4aa69a1c2ff58053e136e08c441e1 100644 (file)
--- a/TODO
+++ b/TODO
@@ -677,9 +677,6 @@ Features:
 
 * merge ~/.local/share and ~/.local/lib into one similar /usr/lib and /usr/share....
 
-* systemd.show_status= should probably have a mode where only failed
-  units are shown.
-
 * add systemd.abort_on_kill or some other such flag to send SIGABRT instead of SIGKILL
   (throughout the codebase, not only PID1)
 
index bbe0834e23395516ceea4c35dd079c2a56d2e613..28bf49e131b1ab56562e32ee96d72dc788b0f039 100644 (file)
       <varlistentry>
         <term><varname>systemd.show_status</varname></term>
 
-        <listitem><para>Takes a boolean argument or the constant
-        <constant>auto</constant>. Can be also specified without an argument, with
-        the same effect as a positive boolean. If enabled, the systemd manager (PID
-        1) shows terse service status updates on the console during bootup.
-        <constant>auto</constant> behaves like <option>false</option> until
-        there is a significant delay in boot. Defaults to enabled, unless
-        <option>quiet</option> is passed as kernel command line option, in which case
-        it defaults to <constant>auto</constant>. If specified overrides the system
-        manager configuration file option <option>ShowStatus=</option>, see
+        <listitem><para>Takes a boolean argument or the constants <constant>error</constant> and
+        <constant>auto</constant>. Can be also specified without an argument, with the same effect as a
+        positive boolean. If enabled, the systemd manager (PID 1) shows terse service status updates on the
+        console during bootup. With <constant>error</constant>, only messages about failures are shown, but
+        boot is otherwise quiet. <constant>auto</constant> behaves like <option>false</option> until there is
+        a significant delay in boot. Defaults to enabled, unless <option>quiet</option> is passed as kernel
+        command line option, in which case it defaults to <constant>error</constant>. If specified overrides
+        the system manager configuration file option <option>ShowStatus=</option>, see
         <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
         </para></listitem>
       </varlistentry>
index 5302c4d27c68bda45363dc8e989d79ae42ce194e..3baecc5f00d162c3a1d5db0cec608c4f2482c249 100644 (file)
@@ -494,7 +494,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
         } else if (streq(key, "quiet") && !value) {
 
                 if (arg_show_status == _SHOW_STATUS_INVALID)
-                        arg_show_status = SHOW_STATUS_AUTO;
+                        arg_show_status = SHOW_STATUS_ERROR;
 
         } else if (streq(key, "debug") && !value) {
 
index e6739e28abb3b975ca8d1f3433eca96093ae744e..6f8065bb08998d3f363c6a9b9a47d03605288bfe 100644 (file)
@@ -4085,7 +4085,7 @@ void manager_recheck_journal(Manager *m) {
 
 void manager_set_show_status(Manager *m, ShowStatus mode, const char *reason) {
         assert(m);
-        assert(IN_SET(mode, SHOW_STATUS_AUTO, SHOW_STATUS_NO, SHOW_STATUS_YES, SHOW_STATUS_TEMPORARY));
+        assert(mode >= 0 && mode < _SHOW_STATUS_MAX);
 
         if (!MANAGER_IS_SYSTEM(m))
                 return;
index c998b51abdb74e68c1580de2a02b1d99c30a2169..9d7358a9c12d741d7283be51a88be4124a9716e9 100644 (file)
@@ -16,6 +16,7 @@
 
 static const char* const show_status_table[_SHOW_STATUS_MAX] = {
         [SHOW_STATUS_NO]        = "no",
+        [SHOW_STATUS_ERROR]     = "error",
         [SHOW_STATUS_AUTO]      = "auto",
         [SHOW_STATUS_TEMPORARY] = "temporary",
         [SHOW_STATUS_YES]       = "yes",
index 0686b60d74a9e2c0f3d73b909fb7b5f7f80fdc27..178f624d6ce0f3ddd4abf1d7cfc8e5cf14da4c3d 100644 (file)
@@ -9,6 +9,7 @@
 
 typedef enum ShowStatus {
         SHOW_STATUS_NO,         /* printing of status is disabled */
+        SHOW_STATUS_ERROR,      /* only print errors */
         SHOW_STATUS_AUTO,       /* disabled but may flip to _TEMPORARY */
         SHOW_STATUS_TEMPORARY,  /* enabled temporarily, may flip back to _AUTO */
         SHOW_STATUS_YES,        /* printing of status is enabled */