diff options
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index f0e19ad8c4..57d15eb34b 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -197,6 +197,7 @@ static int swap_add_device_links(Swap *s) { } static int swap_add_default_dependencies(Swap *s) { + bool nofail = false, noauto = false; int r; assert(s); @@ -211,6 +212,20 @@ static int swap_add_default_dependencies(Swap *s) { if (r < 0) return r; + if (s->from_fragment) { + SwapParameters *p = &s->parameters_fragment; + + nofail = p->nofail; + noauto = p->noauto; + } + + if (!noauto) { + r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, (nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY), + SPECIAL_SWAP_TARGET, NULL, true); + if (r < 0) + return r; + } + return 0; } |