[systemd-commits] man/kernel-command-line.xml man/systemd-fsck at .service.xml src/fsck

Lennart Poettering lennart at kemper.freedesktop.org
Fri May 16 09:40:18 PDT 2014


 man/kernel-command-line.xml   |   11 +++++++++++
 man/systemd-fsck at .service.xml |   16 ++++++++++++++++
 src/fsck/fsck.c               |   14 +++++++++++++-
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit f1f0198cb61a3398557cc9ec596e1e90ac731ed3
Author: Holger Hans Peter Freyther <holger at moiji-mobile.com>
Date:   Thu May 15 19:07:43 2014 +0200

    fsck: Allow to specify the fsck repair option in the cmdline
    
    Some unattended systems do not have a console attached and entering
    the default rescue mode will not be too helpful. Allow to specify
    the "-y" option to attempt to fix all filesystem errors.
    
    Manually verified by downloading an image.gz of e2fsprogs, using
    losetup and running systemd-fsck on the loop device and varying
    the fsck.repair=preen|yes|no option.

diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index dbfec61..a276b71 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -193,6 +193,17 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>fsck.repair=</varname></term>
+
+                                <listitem>
+                                        <para>Parameter understood by
+                                        the file system checker
+                                        services. For details, see
+                                        <citerefentry><refentrytitle>systemd-fsck at .service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+                                </listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>quotacheck.mode=</varname></term>
 
                                 <listitem>
diff --git a/man/systemd-fsck at .service.xml b/man/systemd-fsck at .service.xml
index c653dc5..afd8d9b 100644
--- a/man/systemd-fsck at .service.xml
+++ b/man/systemd-fsck at .service.xml
@@ -98,6 +98,22 @@
                                 skips any file system
                                 checks.</para></listitem>
                         </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>fsck.repair=</varname></term>
+
+                                <listitem><para>One of
+                                <literal>preen</literal>,
+                                <literal>yes</literal>,
+                                <literal>no</literal>. Controls the
+                                mode of operation. The default is <literal>
+                                preen</literal>, and will automatically repair
+                                problems that can be safely fixed. <literal>yes
+                                </literal> will answer yes to all questions by
+                                fsck and <literal>no</literal> will answer no to
+                                all questions.
+                                </para></listitem>
+                        </varlistentry>
                 </variablelist>
         </refsect1>
 
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 5ed837d..594f21e 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -4,6 +4,7 @@
   This file is part of systemd.
 
   Copyright 2010 Lennart Poettering
+  Copyright 2014 Holger Hans Peter Freyther
 
   systemd is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
@@ -42,6 +43,7 @@
 static bool arg_skip = false;
 static bool arg_force = false;
 static bool arg_show_progress = false;
+static const char *arg_repair = "-a";
 
 static void start_target(const char *target) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -85,6 +87,16 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
                         arg_skip = true;
                 else
                         log_warning("Invalid fsck.mode= parameter. Ignoring.");
+        } else if (streq(key, "fsck.repair") && value) {
+
+                if (streq(value, "preen"))
+                        arg_repair = "-a";
+                else if (streq(value, "yes"))
+                        arg_repair = "-y";
+                else if (streq(value, "no"))
+                        arg_repair = "-n";
+                else
+                        log_warning("Invalid fsck.repair= parameter. Ignoring.");
         } else if (startswith(key, "fsck."))
                 log_warning("Invalid fsck parameter. Ignoring.");
 #ifdef HAVE_SYSV_COMPAT
@@ -303,7 +315,7 @@ int main(int argc, char *argv[]) {
                 }
 
         cmdline[i++] = "/sbin/fsck";
-        cmdline[i++] = "-a";
+        cmdline[i++] =  arg_repair;
         cmdline[i++] = "-T";
         cmdline[i++] = "-l";
 



More information about the systemd-commits mailing list