rc single and rc sysinit don't check sysvinit env vars in prefix.
This commit is contained in:
		| @@ -41,21 +41,21 @@ | ||||
| #  define LIB			"lib" | ||||
| #endif | ||||
|  | ||||
| #ifndef PREFIX | ||||
| #  define PREFIX		"" | ||||
| #ifdef PREFIX | ||||
| #  define RC_PREFIX		PREFIX | ||||
| #else | ||||
| #  define HAVE_PREFIX | ||||
| #  define RC_PREFIX | ||||
| #endif | ||||
|  | ||||
| #define RC_LEVEL_BOOT           "boot" | ||||
| #define RC_LEVEL_DEFAULT        "default" | ||||
|  | ||||
| #define RC_LIBDIR               PREFIX "/" LIB "/rc" | ||||
| #define RC_LIBDIR               RC_PREFIX "/" LIB "/rc" | ||||
| #define RC_SVCDIR               RC_LIBDIR "/init.d" | ||||
| #define RC_DEPTREE              RC_SVCDIR "/deptree" | ||||
| #define RC_RUNLEVELDIR          PREFIX "/etc/runlevels" | ||||
| #define RC_INITDIR              PREFIX "/etc/init.d" | ||||
| #define RC_CONFDIR              PREFIX "/etc/conf.d" | ||||
| #define RC_RUNLEVELDIR          RC_PREFIX "/etc/runlevels" | ||||
| #define RC_INITDIR              RC_PREFIX "/etc/init.d" | ||||
| #define RC_CONFDIR              RC_PREFIX "/etc/conf.d" | ||||
|  | ||||
| /* PKG_PREFIX is where packages are installed if different from the base OS | ||||
|  * On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD | ||||
|   | ||||
| @@ -186,7 +186,7 @@ static bool file_regex (const char *file, const char *regex) | ||||
|  | ||||
| const char *rc_sys (void) | ||||
| { | ||||
| #ifdef HAVE_PREFIX | ||||
| #ifdef PREFIX | ||||
| 	return (RC_SYS_PREFIX); | ||||
| #else	 | ||||
|  | ||||
|   | ||||
							
								
								
									
										25
									
								
								src/rc/rc.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/rc/rc.c
									
									
									
									
									
								
							| @@ -550,6 +550,7 @@ static void run_script (const char *script) | ||||
| 		eerrorx ("%s: failed to exec `%s'", applet, script); | ||||
| } | ||||
|  | ||||
| #ifndef PREFIX | ||||
| static void do_coldplug (void) | ||||
| { | ||||
| 	int i; | ||||
| @@ -645,6 +646,7 @@ static void do_coldplug (void) | ||||
| 		printf (" %s", service); | ||||
| 	printf ("%s\n", ecolor (ECOLOR_NORMAL)); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #include "_usage.h" | ||||
| #define getoptstring "o:" getoptstring_COMMON | ||||
| @@ -661,6 +663,7 @@ static const char * const longopts_help[] = { | ||||
| int main (int argc, char **argv) | ||||
| { | ||||
| 	const char *bootlevel = NULL; | ||||
| 	const char *sys = rc_sys (); | ||||
| 	char *newlevel = NULL; | ||||
| 	char *service = NULL; | ||||
| 	char **deporder = NULL; | ||||
| @@ -687,7 +690,10 @@ int main (int argc, char **argv) | ||||
| #ifdef BRANDING | ||||
| 			" " BRANDING | ||||
| #endif | ||||
| 			") version " VERSION "\n", applet); | ||||
| 			")", applet); | ||||
| 		if (sys) | ||||
| 			printf (" [%s]", sys); | ||||
| 		printf (" version " VERSION "\n"); | ||||
| 		exit (EXIT_SUCCESS); | ||||
| 	} | ||||
|  | ||||
| @@ -797,10 +803,13 @@ int main (int argc, char **argv) | ||||
| 	 * rc reboot | ||||
| 	 */ | ||||
| 	if (newlevel) { | ||||
| 		if (strcmp (newlevel, RC_LEVEL_SYSINIT) == 0 && | ||||
| 		    RUNLEVEL && | ||||
| 		if (strcmp (newlevel, RC_LEVEL_SYSINIT) == 0 | ||||
| #ifndef PREFIX | ||||
| 		    && RUNLEVEL && | ||||
| 		    (strcmp (RUNLEVEL, "S") == 0 || | ||||
| 		     strcmp (RUNLEVEL, "1") == 0)) | ||||
| 		     strcmp (RUNLEVEL, "1") == 0) | ||||
| #endif | ||||
| 		) | ||||
| 		{ | ||||
|  | ||||
| 			struct utsname uts; | ||||
| @@ -827,6 +836,10 @@ int main (int argc, char **argv) | ||||
| 				uts.release, | ||||
| 				uts.machine); | ||||
| #endif | ||||
|  | ||||
| 			if (sys) | ||||
| 				printf (" [%s]", sys); | ||||
|  | ||||
| 			printf ("%s\n\n", ecolor (ECOLOR_NORMAL)); | ||||
|  | ||||
| 			if (! rc_yesno (getenv ("EINFO_QUIET")) && | ||||
| @@ -847,7 +860,9 @@ int main (int argc, char **argv) | ||||
| 			} | ||||
| #endif | ||||
|  | ||||
| #ifndef PREFIX | ||||
| 			do_coldplug (); | ||||
| #endif | ||||
| 			rc_plugin_run (RC_HOOK_RUNLEVEL_START_OUT, newlevel); | ||||
|  | ||||
| 			if (want_interactive ()) | ||||
| @@ -855,6 +870,7 @@ int main (int argc, char **argv) | ||||
|  | ||||
| 			exit (EXIT_SUCCESS); | ||||
| 		} else if (strcmp (newlevel, RC_LEVEL_SINGLE) == 0) { | ||||
| #ifndef PREFIX | ||||
| 			if (! RUNLEVEL || | ||||
| 			    (strcmp (RUNLEVEL, "S") != 0 && | ||||
| 			     strcmp (RUNLEVEL, "1") != 0)) | ||||
| @@ -863,6 +879,7 @@ int main (int argc, char **argv) | ||||
| 				set_ksoftlevel (runlevel); | ||||
| 				single_user (); | ||||
| 			} | ||||
| #endif | ||||
| 		} else if (strcmp (newlevel, RC_LEVEL_REBOOT) == 0) { | ||||
| 			if (! RUNLEVEL || | ||||
| 			    strcmp (RUNLEVEL, "6") != 0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user