[systemd-commits] 2 commits - man/kernel-command-line.xml man/systemd-backlight at .service.xml man/systemd-rfkill at .service.xml src/backlight src/rfkill src/shared TODO

Tom Gundersen tomegun at kemper.freedesktop.org
Sat Oct 19 03:16:38 PDT 2013


 TODO                               |    5 +++++
 man/kernel-command-line.xml        |   17 +++++++++++++++++
 man/systemd-backlight at .service.xml |   20 ++++++++++++++++++++
 man/systemd-rfkill at .service.xml    |   20 ++++++++++++++++++++
 src/backlight/backlight.c          |    3 ++-
 src/rfkill/rfkill.c                |    3 ++-
 src/shared/util.c                  |   23 +++++++++++++++++++++++
 src/shared/util.h                  |    2 ++
 8 files changed, 91 insertions(+), 2 deletions(-)

New commits:
commit 295edddf5a2d884222a26935b40a4e99b924543d
Author: Tom Gundersen <teg at jklm.no>
Date:   Sat Oct 19 00:46:07 2013 +0200

    kerne-command-line: introduce option 'systemd.restore_state'
    
    When set to 0 this will stop tools like the backlight and rfkill tools to
    restore state from previous boot. This is useful in case the stored state
    is bogus to the extent that it is preventing you from resetting it (e.g.,
    the backlight settings cause the screen to be off on boot on a system where
    the backlight can not be adjusted directly from the keyboard).

diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index abe68e5..612dc28 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -99,6 +99,21 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>systemd.restore_state=</varname></term>
+                                <listitem>
+                                        <para>Parameter understood by
+                                        several system tools to control
+                                        whether or not they should restore
+                                        system state from the previous boot.
+                                        For details, see
+                                        <citerefentry><refentrytitle>systemd-backlight at .service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                                        and
+                                        <citerefentry><refentrytitle>systemd-rfkill at .service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+                                        </para>
+                                </listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>quiet</varname></term>
                                 <listitem>
                                         <para>Parameter understood by
@@ -307,6 +322,8 @@
                           <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd-modules-load.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                          <citerefentry><refentrytitle>systemd-backlight at .service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                          <citerefentry><refentrytitle>systemd-rfkill at .service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
                   </para>
         </refsect1>
 
diff --git a/man/systemd-backlight at .service.xml b/man/systemd-backlight at .service.xml
index 6d26d4b..672fd05 100644
--- a/man/systemd-backlight at .service.xml
+++ b/man/systemd-backlight at .service.xml
@@ -62,6 +62,26 @@
         </refsect1>
 
         <refsect1>
+                <title>Kernel Command Line</title>
+
+                <para><filename>systemd-backlight</filename> understands
+                the following kernel command line parameter:</para>
+
+                <variablelist class='kernel-commandline-options'>
+                        <varlistentry>
+                                <term><varname>systemd.restore_state=</varname></term>
+
+                                <listitem><para>Takes a boolean
+                                argument. Defaults to
+                                <literal>1</literal>. If
+                                <literal>0</literal>, does not restore
+                                the backlight settings on boot. However,
+                                settings will still be stored on shutdown.
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
                 <title>See Also</title>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
diff --git a/man/systemd-rfkill at .service.xml b/man/systemd-rfkill at .service.xml
index b274cb8..9ae834d 100644
--- a/man/systemd-rfkill at .service.xml
+++ b/man/systemd-rfkill at .service.xml
@@ -62,6 +62,26 @@
         </refsect1>
 
         <refsect1>
+                <title>Kernel Command Line</title>
+
+                <para><filename>systemd-rfkill</filename> understands
+                the following kernel command line parameter:</para>
+
+                <variablelist class='kernel-commandline-options'>
+                        <varlistentry>
+                                <term><varname>systemd.restore_state=</varname></term>
+
+                                <listitem><para>Takes a boolean
+                                argument. Defaults to
+                                <literal>1</literal>. If
+                                <literal>0</literal>, does not restore
+                                the rfkill settings on boot. However,
+                                settings will still be stored on shutdown.
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
                 <title>See Also</title>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index e8cdad6..6c00b00 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -24,6 +24,7 @@
 #include "fileio.h"
 #include "libudev.h"
 #include "udev-util.h"
+#include "util.h"
 
 static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
         struct udev_device *parent;
@@ -290,7 +291,7 @@ int main(int argc, char *argv[]) {
          * device probing should be complete), so that the validity
          * check at boot time doesn't have to be reliable. */
 
-        if (streq(argv[1], "load")) {
+        if (streq(argv[1], "load") && restore_state()) {
                 _cleanup_free_ char *value = NULL;
 
                 if (!validate_device(udev, device))
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 812cf40..b814e5c 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -24,6 +24,7 @@
 #include "fileio.h"
 #include "libudev.h"
 #include "udev-util.h"
+#include "utils.h"
 
 int main(int argc, char *argv[]) {
         _cleanup_udev_unref_ struct udev *udev = NULL;
@@ -95,7 +96,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        if (streq(argv[1], "load")) {
+        if (streq(argv[1], "load") && restore_state()) {
                 _cleanup_free_ char *value = NULL;
 
                 r = read_one_line_file(saved, &value);
diff --git a/src/shared/util.c b/src/shared/util.c
index 1822770..d086fac 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -76,6 +76,7 @@
 #include "device-nodes.h"
 #include "utf8.h"
 #include "gunicode.h"
+#include "virt.h"
 
 int saved_argc = 0;
 char **saved_argv = NULL;
@@ -5990,3 +5991,25 @@ int split_pair(const char *s, const char *sep, char **l, char **r) {
 
         return 0;
 }
+
+bool restore_state(void) {
+        _cleanup_free_ char *line;
+        char *w, *state;
+        int r;
+        size_t l;
+
+        if (detect_container(NULL) > 0)
+                return true;
+
+        r = read_one_line_file("/proc/cmdline", &line);
+        if (r < 0) {
+                log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
+                return 0;
+        }
+
+        FOREACH_WORD_QUOTED(w, l, line, state)
+                if (strneq(w, "systemd.restore_state=0", l))
+                        return false;
+
+        return true;
+}
diff --git a/src/shared/util.h b/src/shared/util.h
index 63cb4ac..dc35b4d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -765,6 +765,8 @@ void parse_user_at_host(char *arg, char **user, char **host);
 
 int split_pair(const char *s, const char *sep, char **l, char **r);
 
+bool restore_state(void);
+
 /**
  * Normal qsort requires base to be nonnull. Here were require
  * that only if nmemb > 0.

commit efc815a13d4b4cae59045c6a120a6c6f7dac2d7b
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Oct 18 21:17:50 2013 +0200

    TODO: add some fsck items

diff --git a/TODO b/TODO
index a3ab09e..29a76ef 100644
--- a/TODO
+++ b/TODO
@@ -719,6 +719,11 @@ Features:
 
 * systemd-run is missing zsh completion scripts
 
+* fsck:
+   - always fsck the rootfs before mounting from the initrd
+   - by default do not fsck the rootfs in the real root, unless passno > 0 in fstab
+   - rip out all fsckpassno handling from the core and treat it as a bolean in the fstab generator
+
 External:
 
 * dbus:



More information about the systemd-commits mailing list