1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

fstab-generator: drop unapplicable options for /usr/ too

We already drop these for /sysroot/usr/ in parse_fstab
(1e9b2e4fdd). Let's make
things consistent, and do the same for /usr/ too (after
switch-root).
This commit is contained in:
Mike Yuan 2024-01-23 00:00:46 +08:00
parent 74467890ff
commit 9f6c32ac96
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3
2 changed files with 4 additions and 4 deletions

View File

@ -565,16 +565,16 @@ static int add_mount(
if (r < 0)
return r;
if (path_equal(where, "/")) {
if (PATH_IN_SET(where, "/", "/usr")) {
r = mandatory_mount_drop_unapplicable_options(&flags, where, opts, &opts_root_filtered);
if (r < 0)
return r;
opts = opts_root_filtered;
if (!strv_isempty(wanted_by))
log_debug("Ignoring 'x-systemd.wanted-by=' option for root device.");
log_debug("Ignoring 'x-systemd.wanted-by=' option for root/usr device.");
if (!strv_isempty(required_by))
log_debug("Ignoring 'x-systemd.required-by=' option for root device.");
log_debug("Ignoring 'x-systemd.required-by=' option for root/usr device.");
required_by = strv_free(required_by);
wanted_by = strv_free(wanted_by);

View File

@ -148,7 +148,7 @@ check_fstab_mount_units() {
fi
if [[ -n "$opts" ]] && [[ "$opts" != defaults ]]; then
# Some options are not propagated to the generated unit
if [[ "$where" == / ]]; then
if [[ "$where" == / || "$where" == /usr ]]; then
filtered_options="$(opt_filter "$opts" "(noauto|nofail|x-systemd.(wanted-by=|required-by=|automount|device-timeout=))")"
else
filtered_options="$(opt_filter "$opts" "^x-systemd.device-timeout=")"