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:
committed by
Luca Boccassi
parent
ace212f577
commit
1355672437
+10
-1
@@ -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);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,8 @@ static inline int find_executable(const char *name, char **ret_filename) {
|
||||
|
||||
bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
|
||||
|
||||
int fsck_exists(const char *fstype);
|
||||
int fsck_exists(void);
|
||||
int fsck_exists_for_fstype(const char *fstype);
|
||||
|
||||
/* Iterates through the path prefixes of the specified path, going up
|
||||
* the tree, to root. Also returns "" (and not "/"!) for the root
|
||||
|
||||
Reference in New Issue
Block a user