aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/includes/rc-misc.h14
-rw-r--r--src/librc/librc.c2
-rw-r--r--src/rc/rc.c27
3 files changed, 30 insertions, 13 deletions
diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h
index 2f4b3643..56cfcfe0 100644
--- a/src/includes/rc-misc.h
+++ b/src/includes/rc-misc.h
@@ -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
diff --git a/src/librc/librc.c b/src/librc/librc.c
index e023efbe..16b0f0b7 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -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
diff --git a/src/rc/rc.c b/src/rc/rc.c
index dbe975de..183c23c3 100644
--- a/src/rc/rc.c
+++ b/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;
@@ -826,7 +835,11 @@ int main (int argc, char **argv)
uts.sysname,
uts.release,
uts.machine);
-#endif
+#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)