teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 8a9eab141ab379c658fc198fb0b0ee4ca3bdd1d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org>
Date: Mon, 30 Sep 2013 01:34:44 +0200
Subject: [PATCH] fstab-generator: Generate explicit dependencies on
 systemd-fsck@.service instead of using FsckPassNo

[tomegun:
  * order all fsck instances after fsck-root
  * check for OOM
  * added notes in the manpages]

Conflicts:
	man/systemd-fsck@.service.xml
	man/systemd-fstab-generator.xml
---
 man/systemd-fsck@.service.xml         |  4 +---
 man/systemd-fstab-generator.xml       |  9 ++++-----
 src/fstab-generator/fstab-generator.c | 21 +++++++++++++++++----
 units/systemd-fsck@.service.in        |  2 +-
 4 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/man/systemd-fsck@.service.xml b/man/systemd-fsck@.service.xml
index c653dc5..17bd1c0 100644
--- a/man/systemd-fsck@.service.xml
+++ b/man/systemd-fsck@.service.xml
@@ -63,9 +63,7 @@
                 check. <filename>systemd-fsck-root.service</filename> is
                 responsible for file system checks on the root
                 file system. The root file system check is performed
-                before the other file systems. Either service is enabled
-                at boot if passno in <filename>/etc/fstab</filename> for
-                the file system is set to a value greater than zero.</para>
+                before the other file systems.</para>
 
                 <para><filename>systemd-fsck</filename> will
                 forward file system checking progress to the
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
index e3cf5d2..740db8f 100644
--- a/man/systemd-fstab-generator.xml
+++ b/man/systemd-fstab-generator.xml
@@ -61,11 +61,10 @@
                 reloaded. This will instantiate mount and swap units
                 as necessary.</para>
 
-                <para>The <varname>passno</varname> field is treated
-                like a simple boolean, and the ordering information is
-                discarded. However, if the root file system is
-                checked, it is checked before all the other
-                file systems.</para>
+                <para>The <term><varname>passno</varname></term> field
+                is treated like a simlpe boolean, and the ordering information
+                is discarded. However, the root filesystem is checked
+                before all the other filesystems.</para>
 
                 <para>See
                 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 6cecb4e..7874ff1 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -209,17 +209,30 @@ static int add_mount(
                         "Before=%s\n",
                         post);
 
+        if (passno > 0) {
+                _cleanup_free_ char *fsck = NULL;
+
+                fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+                if (!fsck)
+                        return log_oom();
+
+                fprintf(f,
+                        "Requires=%s\n"
+                        "After=%s\n",
+                        fsck,
+                        fsck);
+        }
+
+
         fprintf(f,
                 "\n"
                 "[Mount]\n"
                 "What=%s\n"
                 "Where=%s\n"
-                "Type=%s\n"
-                "FsckPassNo=%i\n",
+                "Type=%s\n",
                 what,
                 where,
-                type,
-                passno);
+                type);
 
         if (!isempty(opts) &&
             !streq(opts, "defaults"))
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
index e229cdc..c12efa8 100644
--- a/units/systemd-fsck@.service.in
+++ b/units/systemd-fsck@.service.in
@@ -10,7 +10,7 @@ Description=File System Check on %f
 Documentation=man:systemd-fsck@.service(8)
 DefaultDependencies=no
 BindsTo=%i.device
-After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
+After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service
 Before=shutdown.target
 
 [Service]