]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: properly order generated mount units before "post" target units
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Apr 2021 09:12:39 +0000 (11:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 16:26:17 +0000 (18:26 +0200)
Let's make sure, that our mount unit are properly ordered before the
"post" target unit even if DefaultDependencies= is used on the target
unit.

src/fstab-generator/fstab-generator.c

index 8f5cd0af3ef2809fa045cbb5775e653b3f5b1ce7..110a9bd1baf46a31c4cb486b64e64706827d4bb6 100644 (file)
@@ -433,6 +433,11 @@ static int add_mount(
         if (r < 0)
                 return r;
 
+        /* Order the mount unit we generate relative to the post unit, so that DefaultDependencies= on the
+         * target unit won't affect us. */
+        if (post && !FLAGS_SET(flags, AUTOMOUNT) && !FLAGS_SET(flags, NOAUTO))
+                fprintf(f, "Before=%s\n", post);
+
         if (passno != 0) {
                 r = generator_write_fsck_deps(f, dest, what, where, fstype);
                 if (r < 0)