summaryrefslogtreecommitdiff
path: root/src/fstab-generator/fstab-generator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fstab-generator/fstab-generator.c')
-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();