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