Include sysinit services even in single user.
This commit is contained in:
		
							
								
								
									
										41
									
								
								src/rc/rc.c
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								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,24 +1016,19 @@ 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)
 | 
			
		||||
	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)
 | 
			
		||||
			{
 | 
			
		||||
		if (strcmp (newlevel ? newlevel : runlevel, bootlevel) != 0) {
 | 
			
		||||
			tmplist = rc_services_in_runlevel(newlevel ?
 | 
			
		||||
								  newlevel :
 | 
			
		||||
								  runlevel);
 | 
			
		||||
							  newlevel : runlevel);
 | 
			
		||||
			TAILQ_CONCAT(start_services, tmplist, entries);
 | 
			
		||||
			free(tmplist);
 | 
			
		||||
		}
 | 
			
		||||
@@ -1053,13 +1040,12 @@ int main(int argc, char **argv)
 | 
			
		||||
				rc_stringlist_addu(start_services, service->value);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	parallel = rc_conf_yesno("rc_parallel");
 | 
			
		||||
 | 
			
		||||
	/* 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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user