daandemeyer / rpms / systemd

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