summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-07-01 00:07:32 +0100
committerRoy Marples <roy@marples.name>2009-07-01 00:07:32 +0100
commitb4104957b198b38aba609ed3889e7fa605012d19 (patch)
tree0adad424aa3e5f5ab6fa6cb4f48f9ac9323dc29a /src
parent6abeec74301d8406ebbbd653b9fe9a0e234c09bf (diff)
downloadopenrc-b4104957b198b38aba609ed3889e7fa605012d19.tar.gz
openrc-b4104957b198b38aba609ed3889e7fa605012d19.tar.bz2
openrc-b4104957b198b38aba609ed3889e7fa605012d19.tar.xz
We should use -feature instead of nofeature.
This matches the ifconfig and Gentoo USE flag syntax and is hopefully easier to read. Fixes #178.
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc-depend.c23
-rw-r--r--src/rc/rc.c7
-rw-r--r--src/rc/runscript.c3
3 files changed, 23 insertions, 10 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 97421fa..1fb6506 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -738,7 +738,7 @@ rc_deptree_update(void)
RC_STRING *s, *s2, *s2_np, *s3, *s4;
char *line = NULL;
size_t len = 0;
- char *depend, *depends, *service, *type, *nosys;
+ char *depend, *depends, *service, *type, *nosys, *onosys;
size_t i, k, l;
bool retval = true;
const char *sys = rc_sys();
@@ -841,17 +841,25 @@ rc_deptree_update(void)
* work for them. This doesn't stop them from being run directly. */
if (sys) {
len = strlen(sys);
- nosys = xmalloc(len + 3);
- nosys[0] = 'n';
- nosys[1] = 'o';
+ nosys = xmalloc(len + 1);
+ nosys[0] = '-';
for (i = 0; i < len; i++)
- nosys[i + 2] = (char)tolower((unsigned char)sys[i]);
- nosys[i + 2] = '\0';
+ nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
+ nosys[i + 1] = '\0';
+
+ onosys = xmalloc(len + 3);
+ onosys[0] = 'n';
+ onosys[1] = 'o';
+ for (i = 0; i < len; i++)
+ onosys[i + 2] = (char)tolower((unsigned char)sys[i]);
+ onosys[i + 2] = '\0';
TAILQ_FOREACH_SAFE(depinfo, deptree, entries, depinfo_np)
if ((deptype = get_deptype(depinfo, "keyword")))
TAILQ_FOREACH(s, deptype->services, entries)
- if (strcmp(s->value, nosys) == 0) {
+ if (strcmp(s->value, nosys) == 0 ||
+ strcmp(s->value, onosys) == 0)
+ {
provide = get_deptype(depinfo, "iprovide");
TAILQ_REMOVE(deptree, depinfo, entries);
TAILQ_FOREACH(di, deptree, entries) {
@@ -870,6 +878,7 @@ rc_deptree_update(void)
}
}
free(nosys);
+ free(onosys);
}
/* Phase 3 - add our providers to the tree */
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 3d8628e..6d04b3d 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -600,8 +600,11 @@ do_stop_services(const char *newlevel, bool parallel, bool going_down)
continue;
}
kwords = rc_deptree_depend(deptree, service->value, "keyword");
- if (rc_stringlist_find(kwords, "nostop") ||
- (going_down && rc_stringlist_find(kwords, "noshutdown")))
+ if (rc_stringlist_find(kwords, "-stop") ||
+ rc_stringlist_find(kwords, "nostop") ||
+ (going_down &&
+ (rc_stringlist_find(kwords, "-shutdown") ||
+ rc_stringlist_find(kwords, "noshutdown"))))
nstop = true;
else
nstop = false;
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 91a31a5..ca0d325 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -471,7 +471,8 @@ svc_wait(const char *svc)
/* Some services don't have a timeout, like fsck */
keywords = rc_deptree_depend(deptree, svc, "keyword");
- if (rc_stringlist_find(keywords, "notimeout"))
+ if (rc_stringlist_find(keywords, "-timeout") ||
+ rc_stringlist_find(keywords, "notimeout"))
forever = true;
rc_stringlist_free(keywords);