diff options
author | Tom Gundersen <teg@jklm.no> | 2013-09-16 01:08:32 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-09-16 01:11:52 +0200 |
commit | 4e82fe5213bedcb70e25c0270e516d5f2706d8c8 (patch) | |
tree | d00a7169c7b53dc58ca96572a6bfa9c73c365201 /src/core/swap.c | |
parent | a5c724b25b2930ecb4a64bb4d9b8619a1354afed (diff) |
swap: create .wants symlink to 'auto' swap devices
As we load unit files lazily, we need to make sure something pulls in swap
units that should be started automatically, otherwise the default dependencies
will never be applied.
This partially reinstates code removed in
commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4.
Also don't order swap devices after swap.target when they are 'nofail'.
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index 3950860757..76c7d45006 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -220,8 +220,12 @@ static int swap_add_default_dependencies(Swap *s) { } if (!noauto) { - r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES), - SPECIAL_SWAP_TARGET, NULL, true); + if (nofail) + r = unit_add_dependency_by_name_inverse(UNIT(s), + UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true); + else + r = unit_add_two_dependencies_by_name_inverse(UNIT(s), + UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true); if (r < 0) return r; } |