aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc-depend.c
diff options
context:
space:
mode:
authorIan Stakenvicius <axs@gentoo.org>2015-10-26 15:20:58 -0400
committerWilliam Hubbs <w.d.hubbs@gmail.com>2015-11-12 12:32:45 -0600
commit33d3f33b3ca7dd2ce616b8182d588d0743c2f124 (patch)
tree9cd258ecf6a4787390f4c366bda04adf721bdabe /src/librc/librc-depend.c
parentddb895b355e02c9c07b00bfaf00d1bf8a7abbc03 (diff)
Implement "want" dependency
The want dependency is similar to the use dependency. If a service script, for example called service1, adds "want service2" to its depend function, OpenRC will attempt to start service2, if it exists on the system, when service1 is started. However, service1 will start regardless of the status of service2. X-Gentoo-Bug: 406021 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406021
Diffstat (limited to 'src/librc/librc-depend.c')
-rw-r--r--src/librc/librc-depend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index d7a8ae14..c9c06ad1 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -192,7 +192,9 @@ valid_service(const char *runlevel, const char *service, const char *type)
if (!runlevel ||
strcmp(type, "ineed") == 0 ||
- strcmp(type, "needsme") == 0)
+ strcmp(type, "needsme") == 0 ||
+ strcmp(type, "iwant") == 0 ||
+ strcmp(type, "wantsme") == 0)
return true;
if (rc_service_in_runlevel(service, runlevel))
@@ -543,6 +545,7 @@ rc_deptree_order(const RC_DEPTREE *deptree, const char *runlevel, int options)
types = rc_stringlist_new();
rc_stringlist_add(types, "ineed");
rc_stringlist_add(types, "iuse");
+ rc_stringlist_add(types, "iwant");
rc_stringlist_add(types, "iafter");
services = rc_deptree_depends(deptree, types, list, runlevel,
RC_DEP_STRICT | RC_DEP_TRACE | options);
@@ -648,6 +651,7 @@ typedef struct deppair
static const DEPPAIR deppairs[] = {
{ "ineed", "needsme" },
{ "iuse", "usesme" },
+ { "iwant", "wantsme" },
{ "iafter", "ibefore" },
{ "ibefore", "iafter" },
{ "iprovide", "providedby" },
@@ -844,6 +848,7 @@ rc_deptree_update(void)
/* If we're after something, remove us from the before list */
if (strcmp(type, "iafter") == 0 ||
strcmp(type, "ineed") == 0 ||
+ strcmp(type, "iwant") == 0 ||
strcmp(type, "iuse") == 0) {
if ((dt = get_deptype(depinfo, "ibefore")))
rc_stringlist_delete(dt->services, depend);
@@ -957,6 +962,7 @@ rc_deptree_update(void)
/* Phase 5 - Remove broken before directives */
types = rc_stringlist_new();
rc_stringlist_add(types, "ineed");
+ rc_stringlist_add(types, "iwant");
rc_stringlist_add(types, "iuse");
rc_stringlist_add(types, "iafter");
TAILQ_FOREACH(depinfo, deptree, entries) {