summaryrefslogtreecommitdiff
path: root/automount.c
diff options
context:
space:
mode:
Diffstat (limited to 'automount.c')
-rw-r--r--automount.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/automount.c b/automount.c
index a45cd96505..c28472da76 100644
--- a/automount.c
+++ b/automount.c
@@ -26,7 +26,7 @@
#include "load-fragment.h"
#include "load-dropin.h"
-static int automount_init(Unit *u) {
+static int automount_init(Unit *u, UnitLoadState *new_state) {
int r;
Automount *a = AUTOMOUNT(u);
@@ -35,13 +35,28 @@ static int automount_init(Unit *u) {
exec_context_init(&a->exec_context);
/* Load a .automount file */
- if ((r = unit_load_fragment(u)) < 0)
+ if ((r = unit_load_fragment(u, new_state)) < 0)
return r;
+ if (*new_state == UNIT_STUB)
+ *new_state = UNIT_LOADED;
+
/* Load drop-in directory data */
- if ((r = unit_load_dropin(u)) < 0)
+ if ((r = unit_load_dropin(unit_follow_merge(u))) < 0)
return r;
+ if (*new_state == UNIT_LOADED) {
+
+ if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount))) < 0)
+ return r;
+
+ if ((r = unit_add_exec_dependencies(u, &a->exec_context)) < 0)
+ return r;
+
+ if ((r = unit_add_default_cgroup(u)) < 0)
+ return r;
+ }
+
return 0;
}