fstab-generator: properly order generated mount units before "post" target units

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.
This commit is contained in:
Lennart Poettering 2021-04-07 11:12:39 +02:00
parent e19ae92af6
commit fa138f5e26

View 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)