summaryrefslogtreecommitdiff
path: root/src/shared/generator.c
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2022-12-17 15:06:21 -0500
committerLennart Poettering <lennart@poettering.net>2022-12-23 18:34:09 +0100
commit0941ccae3cf28d84db87fb9d50cc10750bc1c962 (patch)
treebf5a6b14be3b8408fa2b4a86941d3da151918167 /src/shared/generator.c
parentc2c38276cb3185f1c383cffe77635bc1411dbc2c (diff)
downloadsystemd-0941ccae3cf28d84db87fb9d50cc10750bc1c962.tar.gz
sysroot: Order systemd-fsck-root after systemd-makefs
Diffstat (limited to 'src/shared/generator.c')
-rw-r--r--src/shared/generator.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 7eed3b76c1..da3eaadbf4 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -467,6 +467,14 @@ int generator_hook_up_mkfs(
log_debug("Creating %s", unit_file);
+ const char *fsck_unit;
+ if (in_initrd() && path_equal(where, "/sysroot"))
+ fsck_unit = SPECIAL_FSCK_ROOT_SERVICE;
+ else if (in_initrd() && path_equal(where, "/sysusr/usr"))
+ fsck_unit = SPECIAL_FSCK_USR_SERVICE;
+ else
+ fsck_unit = "systemd-fsck@%i.service";
+
escaped = cescape(node);
if (!escaped)
return log_oom();
@@ -492,7 +500,7 @@ int generator_hook_up_mkfs(
"After=%%i.device\n"
/* fsck might or might not be used, so let's be safe and order
* ourselves before both systemd-fsck@.service and the mount unit. */
- "Before=shutdown.target systemd-fsck@%%i.service %s\n"
+ "Before=shutdown.target %s %s\n"
"\n"
"[Service]\n"
"Type=oneshot\n"
@@ -500,6 +508,7 @@ int generator_hook_up_mkfs(
"ExecStart="SYSTEMD_MAKEFS_PATH " %s %s\n"
"TimeoutSec=0\n",
program_invocation_short_name,
+ fsck_unit,
where_unit,
type,
escaped);