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