1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

repart: add simple mechanism to override fstype choices

This is very useful for quickly testing things when building DDIs, in
particular in the CI, and trivial to add.
This commit is contained in:
Lennart Poettering 2023-10-05 18:54:43 +02:00
parent 489b0f515b
commit e59049d7a9
2 changed files with 12 additions and 0 deletions

View File

@ -552,3 +552,6 @@ SYSTEMD_HOME_DEBUG_SUFFIX=foo \
* `$SYSTEMD_REPART_MKFS_OPTIONS_<FSTYPE>` configure additional arguments to use for
`mkfs` when formatting partition file systems. There's one variable for each
of the supported file systems.
* `$SYSTEMD_REPART_OVERRIDE_FSTYPE` if set the value will override the file
system type specified in Format= lines in partition definition files.

View File

@ -1378,9 +1378,18 @@ static int config_parse_fstype(
void *userdata) {
char **fstype = ASSERT_PTR(data);
const char *e;
assert(rvalue);
/* Let's provide an easy way to override the chosen fstype for file system partitions */
e = secure_getenv("SYSTEMD_REPART_OVERRIDE_FSTYPE");
if (e && !streq(rvalue, e)) {
log_syntax(unit, LOG_NOTICE, filename, line, 0,
"Overriding defined file system type '%s' with '%s'.", rvalue, e);
rvalue = e;
}
if (!filename_is_valid(rvalue))
return log_syntax(unit, LOG_ERR, filename, line, 0,
"File system type is not valid, refusing: %s", rvalue);