aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-03 08:38:27 +0000
committerRoy Marples <roy@marples.name>2007-07-03 08:38:27 +0000
commit9c7bbdd7748109e8043e061e95a794dc15e8e41c (patch)
treeabe2299936e3f094b7672b41fd7c70c3d2b9689c
parentf23b6d0e95346a93db3fbf8dbec300f8e6a7b12a (diff)
We still need to wait for services we need/use
-rw-r--r--src/runscript.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/runscript.c b/src/runscript.c
index 8bebf746..cbdc98a9 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -47,6 +47,7 @@ static char **providelist = NULL;
static char **types = NULL;
static char **restart_services = NULL;
static char **need_services = NULL;
+static char **use_services = NULL;
static char **env = NULL;
static char *tmp = NULL;
static char *softlevel = NULL;
@@ -254,6 +255,7 @@ static void cleanup (void)
rc_strlist_free (svclist);
rc_strlist_free (providelist);
rc_strlist_free (need_services);
+ rc_strlist_free (use_services);
rc_strlist_free (tmplist);
free (ibsave);
@@ -632,18 +634,19 @@ static void svc_start (bool deps)
rc_strlist_free (need_services);
need_services = rc_get_depends (deptree, types, svclist,
softlevel, depoptions);
+
types = rc_strlist_add (types, "iuse");
- if (! rc_runlevel_starting ()) {
- services = rc_get_depends (deptree, types, svclist,
+ rc_strlist_free (use_services);
+ use_services = rc_get_depends (deptree, types, svclist,
softlevel, depoptions);
- STRLIST_FOREACH (services, svc, i)
+
+ if (! rc_runlevel_starting ()) {
+ STRLIST_FOREACH (use_services, svc, i)
if (rc_service_state (svc, rc_service_stopped)) {
pid_t pid = rc_start_service (svc);
if (! rc_is_env ("RC_PARALLEL", "yes"))
rc_waitpid (pid);
}
-
- rc_strlist_free (services);
}
/* Now wait for them to start */
@@ -656,12 +659,22 @@ static void svc_start (bool deps)
tmplist = NULL;
STRLIST_FOREACH (services, svc, i) {
- /* don't wait for services which went inactive but are now in
- * starting state */
- if (rc_service_state (svc, rc_service_started) ||
- (rc_service_state (svc, rc_service_starting) &&
- rc_service_state(svc, rc_service_wasinactive)))
+ if (rc_service_state (svc, rc_service_started))
continue;
+
+ /* Don't wait for services which went inactive but are now in
+ * starting state which we are after */
+ if (rc_service_state (svc, rc_service_starting) &&
+ rc_service_state(svc, rc_service_wasinactive)) {
+ bool use = false;
+ STRLIST_FOREACH (use_services, svc2, j)
+ if (strcmp (svc, svc2) == 0) {
+ use = true;
+ break;
+ }
+ if (! use)
+ continue;
+ }
if (! rc_wait_service (svc))
eerror ("%s: timed out waiting for %s", applet, svc);