summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-08-21 22:48:56 +0800
committerTom Gundersen <teg@jklm.no>2013-09-11 14:43:24 +0200
commit64347fc2b983f33e7efb0fd2bb44e133fb9f30f4 (patch)
tree4dbaaccf37c9bf4904e7ccf15cfd94134c17bbe8 /src/core
parent88ac30a1979365a926bc85a9cd7150da85823077 (diff)
swap: handle nofail/noauto in core
Diffstat (limited to 'src/core')
-rw-r--r--src/core/swap.c15
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;
}