dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
9fc0f6
From 23623890843b81c5d0bd6115ae1f458539b2d43b Mon Sep 17 00:00:00 2001
9fc0f6
From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org>
9fc0f6
Date: Mon, 30 Sep 2013 01:34:45 +0200
9fc0f6
Subject: [PATCH] gpt-auto-generator: Generate explicit dependencies on
9fc0f6
 systemd-fsck@.service instead of using FsckPassNo
9fc0f6
9fc0f6
[tomegun: check for OOM]
9fc0f6
---
9fc0f6
 src/gpt-auto-generator/gpt-auto-generator.c | 14 +++++++++-----
9fc0f6
 1 file changed, 9 insertions(+), 5 deletions(-)
9fc0f6
9fc0f6
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
index f1749be..adbf71d 100644
9fc0f6
--- a/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
@@ -179,7 +179,7 @@ static int add_swap(const char *path, const char *fstype) {
9fc0f6
 }
9fc0f6
 
9fc0f6
 static int add_home(const char *path, const char *fstype) {
9fc0f6
-        _cleanup_free_ char *unit = NULL, *lnk = NULL;
9fc0f6
+        _cleanup_free_ char *unit = NULL, *lnk = NULL, *fsck = NULL;
9fc0f6
         _cleanup_fclose_ FILE *f = NULL;
9fc0f6
 
9fc0f6
         if (dir_is_empty("/home") <= 0)
9fc0f6
@@ -197,19 +197,23 @@ static int add_home(const char *path, const char *fstype) {
9fc0f6
                 return -errno;
9fc0f6
         }
9fc0f6
 
9fc0f6
+        fsck = unit_name_from_path_instance("systemd-fsck", path, ".service");
9fc0f6
+        if (!fsck)
9fc0f6
+                return log_oom();
9fc0f6
+
9fc0f6
         fprintf(f,
9fc0f6
                 "# Automatically generated by systemd-gpt-auto-generator\n\n"
9fc0f6
                 "[Unit]\n"
9fc0f6
                 "DefaultDependencies=no\n"
9fc0f6
-                "After=" SPECIAL_LOCAL_FS_PRE_TARGET "\n"
9fc0f6
+                "Requires=%s\n"
9fc0f6
+                "After=" SPECIAL_LOCAL_FS_PRE_TARGET " %s\n"
9fc0f6
                 "Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
9fc0f6
                 "Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_LOCAL_FS_TARGET "\n\n"
9fc0f6
                 "[Mount]\n"
9fc0f6
                 "What=%s\n"
9fc0f6
                 "Where=/home\n"
9fc0f6
-                "Type=%s\n"
9fc0f6
-                "FsckPassNo=2\n",
9fc0f6
-                path, fstype);
9fc0f6
+                "Type=%s\n",
9fc0f6
+                fsck, fsck, path, fstype);
9fc0f6
 
9fc0f6
         fflush(f);
9fc0f6
         if (ferror(f)) {