dcavalca / rpms / systemd

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