Include sysinit services even in single user.
This commit is contained in:
parent
734e60608a
commit
0a39145a5e
65
src/rc/rc.c
65
src/rc/rc.c
@ -621,7 +621,7 @@ static bool runlevel_config(const char *service, const char *level)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void do_stop_services(const char *newlevel, bool going_down, bool parallel)
|
||||
static void do_stop_services(const char *newlevel, bool parallel)
|
||||
{
|
||||
pid_t pid;
|
||||
RC_STRING *service, *svc1, *svc2;
|
||||
@ -646,14 +646,6 @@ static void do_stop_services(const char *newlevel, bool going_down, bool paralle
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We always stop the service when in these runlevels */
|
||||
if (going_down || ! start_services) {
|
||||
pid = service_stop(service->value);
|
||||
if (pid > 0 && ! parallel)
|
||||
rc_waitpid(pid);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we're in the start list then don't bother stopping us */
|
||||
svc1 = rc_stringlist_find(start_services, service->value);
|
||||
if (svc1) {
|
||||
@ -1024,34 +1016,28 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Load our list of hotplugged services */
|
||||
hotplugged_services = rc_services_in_state(RC_SERVICE_HOTPLUGGED);
|
||||
if (strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SINGLE) != 0 &&
|
||||
strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SHUTDOWN) != 0 &&
|
||||
strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_REBOOT) != 0)
|
||||
{
|
||||
if (!going_down ||
|
||||
strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SINGLE) == 0)
|
||||
start_services = rc_services_in_runlevel(RC_LEVEL_SYSINIT);
|
||||
if (strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_SYSINIT)
|
||||
!= 0)
|
||||
{
|
||||
/* We need to include the boot runlevel services */
|
||||
tmplist = rc_services_in_runlevel(bootlevel);
|
||||
if (!going_down &&
|
||||
strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SYSINIT) != 0)
|
||||
{
|
||||
/* We need to include the boot runlevel services */
|
||||
tmplist = rc_services_in_runlevel(bootlevel);
|
||||
TAILQ_CONCAT(start_services, tmplist, entries);
|
||||
free(tmplist);
|
||||
if (strcmp (newlevel ? newlevel : runlevel, bootlevel) != 0) {
|
||||
tmplist = rc_services_in_runlevel(newlevel ?
|
||||
newlevel : runlevel);
|
||||
TAILQ_CONCAT(start_services, tmplist, entries);
|
||||
free(tmplist);
|
||||
if (strcmp (newlevel ? newlevel : runlevel, bootlevel)
|
||||
!= 0)
|
||||
{
|
||||
tmplist = rc_services_in_runlevel(newlevel ?
|
||||
newlevel :
|
||||
runlevel);
|
||||
TAILQ_CONCAT(start_services, tmplist, entries);
|
||||
free(tmplist);
|
||||
}
|
||||
}
|
||||
|
||||
if (hotplugged_services) {
|
||||
if (!start_services)
|
||||
start_services = rc_stringlist_new();
|
||||
TAILQ_FOREACH(service, hotplugged_services, entries)
|
||||
rc_stringlist_addu(start_services, service->value);
|
||||
}
|
||||
if (hotplugged_services) {
|
||||
if (!start_services)
|
||||
start_services = rc_stringlist_new();
|
||||
TAILQ_FOREACH(service, hotplugged_services, entries)
|
||||
rc_stringlist_addu(start_services, service->value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1059,7 +1045,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Now stop the services that shouldn't be running */
|
||||
if (stop_services)
|
||||
do_stop_services(newlevel, going_down, parallel);
|
||||
do_stop_services(newlevel, parallel);
|
||||
|
||||
/* Wait for our services to finish */
|
||||
wait_for_services();
|
||||
@ -1089,13 +1075,6 @@ int main(int argc, char **argv)
|
||||
applet, HALTSH, strerror(errno));
|
||||
}
|
||||
|
||||
/* Single user is done now */
|
||||
if (strcmp(runlevel, RC_LEVEL_SINGLE) == 0) {
|
||||
if (exists(INTERACTIVE))
|
||||
unlink(INTERACTIVE);
|
||||
sulogin(false);
|
||||
}
|
||||
|
||||
mkdir(RC_STARTING, 0755);
|
||||
rc_plugin_run(RC_HOOK_RUNLEVEL_START_IN, runlevel);
|
||||
hook_out = RC_HOOK_RUNLEVEL_START_OUT;
|
||||
@ -1159,5 +1138,9 @@ int main(int argc, char **argv)
|
||||
if (regen && strcmp(runlevel, bootlevel) == 0)
|
||||
unlink(RC_DEPTREE_CACHE);
|
||||
|
||||
/* Single user is done now */
|
||||
if (strcmp(runlevel, RC_LEVEL_SINGLE) == 0)
|
||||
sulogin(false);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user