diff options
Diffstat (limited to 'src/swap.c')
-rw-r--r-- | src/swap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/swap.c b/src/swap.c index 92035144ba..de468a0434 100644 --- a/src/swap.c +++ b/src/swap.c @@ -120,6 +120,24 @@ static int swap_add_target_links(Swap *s) { return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true); } +static int swap_add_default_dependencies(Swap *s) { + int r; + + assert(s); + + if (s->meta.manager->running_as == MANAGER_SYSTEM) { + + if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) + return r; + + /* Note that by default we don't disable swap devices + * on shutdown. i.e. there is no umount.target + * conflicts here. */ + } + + return 0; +} + static int swap_verify(Swap *s) { bool b; char *e; @@ -185,6 +203,10 @@ static int swap_load(Unit *u) { if ((r = swap_add_target_links(s)) < 0) return r; + + if (s->meta.default_dependencies) + if ((r = swap_add_default_dependencies(s)) < 0) + return r; } return swap_verify(s); |