From 85e9a1010d16064ce435b84f02dc585bc645aade Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Fri, 20 Jul 2012 15:55:01 +0200 Subject: systemd: added new dependency PartOf This should address TODO item "new dependency type to "group" services in a target". Semantic of new dependency is as follows. Once configured it creates dependency which will cause that all dependent units get stopped if unit they all depend on is stopped or restarted. Usual use case would be configuring PartOf=some.target in template unit file and WantedBy=some.target in [Install] section and enabling desired number of instances. In this case starting one instance won't pull in target but stopping or starting target(in case of WantedBy is properly configured) will cause stop/start of all instances. --- src/core/transaction.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core/transaction.c') diff --git a/src/core/transaction.c b/src/core/transaction.c index a1cf706934..1f8d803aeb 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -994,6 +994,18 @@ int transaction_add_job_and_dependencies( dbus_error_free(e); } } + + SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONSISTS_OF], i) { + r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e); + if (r < 0) { + if (r != -EBADR) + goto fail; + + if (e) + dbus_error_free(e); + } + } + } if (type == JOB_RELOAD) { -- cgit v1.2.3-54-g00ecf