richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
65878a
From 8a9eab141ab379c658fc198fb0b0ee4ca3bdd1d2 Mon Sep 17 00:00:00 2001
65878a
From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org>
65878a
Date: Mon, 30 Sep 2013 01:34:44 +0200
65878a
Subject: [PATCH] fstab-generator: Generate explicit dependencies on
65878a
 systemd-fsck@.service instead of using FsckPassNo
65878a
65878a
[tomegun:
65878a
  * order all fsck instances after fsck-root
65878a
  * check for OOM
65878a
  * added notes in the manpages]
65878a
65878a
Conflicts:
65878a
	man/systemd-fsck@.service.xml
65878a
	man/systemd-fstab-generator.xml
65878a
---
65878a
 man/systemd-fsck@.service.xml         |  4 +---
65878a
 man/systemd-fstab-generator.xml       |  9 ++++-----
65878a
 src/fstab-generator/fstab-generator.c | 21 +++++++++++++++++----
65878a
 units/systemd-fsck@.service.in        |  2 +-
65878a
 4 files changed, 23 insertions(+), 13 deletions(-)
65878a
65878a
diff --git a/man/systemd-fsck@.service.xml b/man/systemd-fsck@.service.xml
65878a
index c653dc5..17bd1c0 100644
65878a
--- a/man/systemd-fsck@.service.xml
65878a
+++ b/man/systemd-fsck@.service.xml
65878a
@@ -63,9 +63,7 @@
65878a
                 check. <filename>systemd-fsck-root.service</filename> is
65878a
                 responsible for file system checks on the root
65878a
                 file system. The root file system check is performed
65878a
-                before the other file systems. Either service is enabled
65878a
-                at boot if passno in <filename>/etc/fstab</filename> for
65878a
-                the file system is set to a value greater than zero.</para>
65878a
+                before the other file systems.</para>
65878a
 
65878a
                 <para><filename>systemd-fsck</filename> will
65878a
                 forward file system checking progress to the
65878a
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
65878a
index e3cf5d2..740db8f 100644
65878a
--- a/man/systemd-fstab-generator.xml
65878a
+++ b/man/systemd-fstab-generator.xml
65878a
@@ -61,11 +61,10 @@
65878a
                 reloaded. This will instantiate mount and swap units
65878a
                 as necessary.</para>
65878a
 
65878a
-                <para>The <varname>passno</varname> field is treated
65878a
-                like a simple boolean, and the ordering information is
65878a
-                discarded. However, if the root file system is
65878a
-                checked, it is checked before all the other
65878a
-                file systems.</para>
65878a
+                <para>The <term><varname>passno</varname></term> field
65878a
+                is treated like a simlpe boolean, and the ordering information
65878a
+                is discarded. However, the root filesystem is checked
65878a
+                before all the other filesystems.</para>
65878a
 
65878a
                 <para>See
65878a
                 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65878a
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
65878a
index 6cecb4e..7874ff1 100644
65878a
--- a/src/fstab-generator/fstab-generator.c
65878a
+++ b/src/fstab-generator/fstab-generator.c
65878a
@@ -209,17 +209,30 @@ static int add_mount(
65878a
                         "Before=%s\n",
65878a
                         post);
65878a
 
65878a
+        if (passno > 0) {
65878a
+                _cleanup_free_ char *fsck = NULL;
65878a
+
65878a
+                fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
65878a
+                if (!fsck)
65878a
+                        return log_oom();
65878a
+
65878a
+                fprintf(f,
65878a
+                        "Requires=%s\n"
65878a
+                        "After=%s\n",
65878a
+                        fsck,
65878a
+                        fsck);
65878a
+        }
65878a
+
65878a
+
65878a
         fprintf(f,
65878a
                 "\n"
65878a
                 "[Mount]\n"
65878a
                 "What=%s\n"
65878a
                 "Where=%s\n"
65878a
-                "Type=%s\n"
65878a
-                "FsckPassNo=%i\n",
65878a
+                "Type=%s\n",
65878a
                 what,
65878a
                 where,
65878a
-                type,
65878a
-                passno);
65878a
+                type);
65878a
 
65878a
         if (!isempty(opts) &&
65878a
             !streq(opts, "defaults"))
65878a
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
65878a
index e229cdc..c12efa8 100644
65878a
--- a/units/systemd-fsck@.service.in
65878a
+++ b/units/systemd-fsck@.service.in
65878a
@@ -10,7 +10,7 @@ Description=File System Check on %f
65878a
 Documentation=man:systemd-fsck@.service(8)
65878a
 DefaultDependencies=no
65878a
 BindsTo=%i.device
65878a
-After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
65878a
+After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service
65878a
 Before=shutdown.target
65878a
 
65878a
 [Service]