diff options
-rw-r--r-- | src/builtins.h | 2 | ||||
-rw-r--r-- | src/rc-depend.c | 7 | ||||
-rw-r--r-- | src/rc.c | 10 | ||||
-rw-r--r-- | src/runscript.c | 7 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/builtins.h b/src/builtins.h index 9363f9eb..1e7a5348 100644 --- a/src/builtins.h +++ b/src/builtins.h @@ -37,4 +37,4 @@ int runscript (int argc, char **argv); int start_stop_daemon (int argc, char **argv); /* Handy function so we can wrap einfo around our deptree */ -rc_depinfo_t *_rc_deptree_load (void); +rc_depinfo_t *_rc_deptree_load (int *regen); diff --git a/src/rc-depend.c b/src/rc-depend.c index d3e319f7..de0125fc 100644 --- a/src/rc-depend.c +++ b/src/rc-depend.c @@ -48,10 +48,13 @@ #include "rc-misc.h" #include "strlist.h" -rc_depinfo_t *_rc_deptree_load (void) { +rc_depinfo_t *_rc_deptree_load (int *regen) { if (rc_deptree_update_needed ()) { int retval; + if (regen) + *regen = 1; + ebegin ("Caching service dependencies"); retval = rc_deptree_update (); eend (retval ? 0 : -1, "Failed to update the dependency tree"); @@ -129,7 +132,7 @@ int rc_depend (int argc, char **argv) eerrorx ("Failed to update the dependency tree"); } - if (! (deptree = _rc_deptree_load ())) + if (! (deptree = _rc_deptree_load (NULL))) eerrorx ("failed to load deptree"); if (! runlevel) @@ -803,6 +803,7 @@ int main (int argc, char **argv) DIR *dp; struct dirent *d; bool parallel; + int regen = 0; atexit (cleanup); if (argv[0]) @@ -1105,7 +1106,7 @@ int main (int argc, char **argv) } /* Load our deptree now */ - if ((deptree = _rc_deptree_load ()) == NULL) + if ((deptree = _rc_deptree_load (®en)) == NULL) eerrorx ("failed to load deptree"); /* Clean the failed services state dir now */ @@ -1437,7 +1438,6 @@ int main (int argc, char **argv) } #endif - STRLIST_FOREACH (start_services, service, i) { if (rc_service_state (service) & RC_SERVICE_STOPPED) { pid_t pid; @@ -1502,6 +1502,12 @@ interactive_option: unlink (INTERACTIVE); } + /* If we're in the boot runlevel and we regenerated our dependencies + * we need to delete them so that they are regenerated again in the + * default runlevel as they may depend on things that are now available */ + if (regen && strcmp (runlevel, bootlevel) == 0) + unlink (RC_DEPTREE); + return (EXIT_SUCCESS); } diff --git a/src/runscript.c b/src/runscript.c index e4089c21..88ce71b8 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -684,7 +684,7 @@ static void svc_start (bool deps) depoptions |= RC_DEP_START; if (deps) { - if (! deptree && ((deptree = _rc_deptree_load ()) == NULL)) + if (! deptree && ((deptree = _rc_deptree_load (NULL)) == NULL)) eerrorx ("failed to load deptree"); rc_strlist_free (services); @@ -898,7 +898,7 @@ static void svc_stop (bool deps) if (rc_runlevel_stopping ()) depoptions |= RC_DEP_STOP; - if (! deptree && ((deptree = _rc_deptree_load ()) == NULL)) + if (! deptree && ((deptree = _rc_deptree_load (NULL)) == NULL)) eerrorx ("failed to load deptree"); rc_strlist_free (tmplist); @@ -1078,6 +1078,7 @@ int runscript (int argc, char **argv) /* Show help if insufficient args */ if (argc < 3) { + setenv ("SVCNAME", applet, 1); execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL); eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s", applet, strerror (errno)); @@ -1259,7 +1260,7 @@ int runscript (int argc, char **argv) if (rc_conf_yesno ("rc_depend_strict")) depoptions |= RC_DEP_STRICT; - if (! deptree && ((deptree = _rc_deptree_load ()) == NULL)) + if (! deptree && ((deptree = _rc_deptree_load (NULL)) == NULL)) eerrorx ("failed to load deptree"); rc_strlist_free (services); |