swap: add only swaps listed in /etc/fstab automatically to swap.target, others should be added via .wants/ links
This commit is contained in:
parent
da8f9f8cff
commit
510051fc12
2
TODO
2
TODO
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
* make description of .swap files nicer: resolve /dev/by-uuid/ symlink
|
* make description of .swap files nicer: resolve /dev/by-uuid/ symlink
|
||||||
|
|
||||||
* only add quotacheck deps t .mount units which mention grpquota/usrquota in the mount flags
|
* only add quotacheck deps to .mount units which mention grpquota/usrquota in the mount flags
|
||||||
|
|
||||||
External:
|
External:
|
||||||
|
|
||||||
|
|
11
src/mount.c
11
src/mount.c
|
@ -265,7 +265,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, user;
|
bool noauto, handle, automount;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
|
@ -277,7 +277,6 @@ 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") ||
|
||||||
m->meta.manager->mount_auto;
|
m->meta.manager->mount_auto;
|
||||||
automount = !!mount_test_option(p->options, "comment=systemd.automount");
|
automount = !!mount_test_option(p->options, "comment=systemd.automount");
|
||||||
|
@ -311,10 +310,10 @@ static int mount_add_target_links(Mount *m) {
|
||||||
* configured to local-fs.target */
|
* configured to local-fs.target */
|
||||||
if (!noauto &&
|
if (!noauto &&
|
||||||
handle &&
|
handle &&
|
||||||
!m->from_fragment)
|
m->from_etc_fstab &&
|
||||||
if (user || m->meta.manager->running_as == MANAGER_SYSTEM)
|
m->meta.manager->running_as == MANAGER_SYSTEM)
|
||||||
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(m), true)) < 0)
|
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(m), true)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
return unit_add_dependency(UNIT(m), UNIT_BEFORE, tu, true);
|
return unit_add_dependency(UNIT(m), UNIT_BEFORE, tu, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ static int swap_add_target_links(Swap *s) {
|
||||||
|
|
||||||
if (!p->noauto &&
|
if (!p->noauto &&
|
||||||
(p->handle || s->meta.manager->swap_auto) &&
|
(p->handle || s->meta.manager->swap_auto) &&
|
||||||
!s->from_fragment &&
|
s->from_etc_fstab &&
|
||||||
s->meta.manager->running_as == MANAGER_SYSTEM)
|
s->meta.manager->running_as == MANAGER_SYSTEM)
|
||||||
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(s), true)) < 0)
|
if ((r = unit_add_dependency(tu, UNIT_WANTS, UNIT(s), true)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
Loading…
Reference in New Issue