mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-22 15:03:34 +07:00
mount: add remote-fs.target/local-fs.target Wants links only when running as system instance
This commit is contained in:
parent
9f23530860
commit
307e85efbb
10
src/mount.c
10
src/mount.c
@ -215,7 +215,7 @@ static int mount_add_target_links(Mount *m) {
|
|||||||
MountParameters *p;
|
MountParameters *p;
|
||||||
Unit *tu;
|
Unit *tu;
|
||||||
int r;
|
int r;
|
||||||
bool noauto, handle, automount;
|
bool noauto, handle, automount, user;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
@ -227,6 +227,7 @@ static int mount_add_target_links(Mount *m) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
noauto = !!mount_test_option(p->options, MNTOPT_NOAUTO);
|
noauto = !!mount_test_option(p->options, MNTOPT_NOAUTO);
|
||||||
|
user = mount_test_option(p->options, "user") || mount_test_option(p->options, "users");
|
||||||
handle = !!mount_test_option(p->options, "comment=systemd.mount");
|
handle = !!mount_test_option(p->options, "comment=systemd.mount");
|
||||||
automount = !!mount_test_option(p->options, "comment=systemd.automount");
|
automount = !!mount_test_option(p->options, "comment=systemd.automount");
|
||||||
|
|
||||||
@ -239,7 +240,7 @@ static int mount_add_target_links(Mount *m) {
|
|||||||
if ((r = manager_load_unit(UNIT(m)->meta.manager, target, NULL, &tu)) < 0)
|
if ((r = manager_load_unit(UNIT(m)->meta.manager, target, NULL, &tu)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (automount) {
|
if (automount && m->meta.manager->running_as != MANAGER_SESSION) {
|
||||||
Unit *am;
|
Unit *am;
|
||||||
|
|
||||||
if ((r = unit_load_related_unit(UNIT(m), ".automount", &am)) < 0)
|
if ((r = unit_load_related_unit(UNIT(m), ".automount", &am)) < 0)
|
||||||
@ -253,8 +254,9 @@ static int mount_add_target_links(Mount *m) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!noauto && handle)
|
if (!noauto && handle)
|
||||||
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(m), true)) < 0)
|
if (user || m->meta.manager->running_as != MANAGER_SESSION)
|
||||||
return r;
|
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(m), true)) < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
return unit_add_dependency(UNIT(m), UNIT_BEFORE, tu, true);
|
return unit_add_dependency(UNIT(m), UNIT_BEFORE, tu, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user