generator: skip fsck if fsck command is missing

This is useful for systems which don't have any fsck.

We already skip emitting the fsck dependency when the fsck.$fstype helper
is missing, but fstab-generator doesn't necessarily know the fstype when
handling the root= parameter.

Previously, systemd-fsck was started for these mounts and then exited
immediately because it couldn't find the fsck.$fstype helper.
This commit is contained in:
Jonas Kümmerlin
2022-09-30 15:01:41 +01:00
committed by Luca Boccassi
parent ace212f577
commit 1355672437
8 changed files with 37 additions and 10 deletions
+10 -1
View File
@@ -782,14 +782,23 @@ static int executable_is_good(const char *executable) {
"/dev/null");
}
int fsck_exists(const char *fstype) {
int fsck_exists(void) {
return executable_is_good("fsck");
}
int fsck_exists_for_fstype(const char *fstype) {
const char *checker;
int r;
assert(fstype);
if (streq(fstype, "auto"))
return -EINVAL;
r = fsck_exists();
if (r <= 0)
return r;
checker = strjoina("fsck.", fstype);
return executable_is_good(checker);
}