summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-10-19 11:38:42 +0200
committerTom Gundersen <teg@jklm.no>2013-10-19 12:23:17 +0200
commita7623afb7a48ab1d7b5b24fbd5f1033acfb2301c (patch)
treed7ca2f0a633d4554f822c97bfa3540eeb23eeba8 /src
parentd09ee17da21b7ca2259067ac4e54f8a1cc3c0fc0 (diff)
fsck-root: only run when requested in fstab
fsck-root is redundant in case an initrd is used, or in case the rootfs is never remounted 'rw', so the new default is the correct behavior for most users. For the rest, they should enable it in fstab.
Diffstat (limited to 'src')
-rw-r--r--src/fstab-generator/fstab-generator.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 77247dee5e..78d7609c6c 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -210,17 +210,29 @@ static int add_mount(
post);
if (passno > 0) {
- _cleanup_free_ char *fsck = NULL;
+ if (streq(where, "/")) {
+ lnk = strjoin(arg_dest, "/", SPECIAL_LOCAL_FS_TARGET, ".wants/", "systemd-fsck-root.service", NULL);
+ if (!lnk)
+ return log_oom();
- fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
- if (!fsck)
- return log_oom();
+ mkdir_parents_label(lnk, 0755);
+ if (symlink("systemd-fsck-root.service", lnk) < 0) {
+ log_error("Failed to create symlink %s: %m", lnk);
+ return -errno;
+ }
+ } else {
+ _cleanup_free_ char *fsck = NULL;
- fprintf(f,
- "Requires=%s\n"
- "After=%s\n",
- fsck,
- fsck);
+ 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);
+ }
}
@@ -248,6 +260,7 @@ static int add_mount(
if (!noauto) {
if (post) {
+ free(lnk);
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
if (!lnk)
return log_oom();