summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-04-06 20:06:07 +0000
committerRoy Marples <roy@marples.name>2008-04-06 20:06:07 +0000
commitdcdfdb442f436cd1f1bdfdc46622f5d6f48f8061 (patch)
tree64ab72215c49e46a01224e272c3da1a4b2ef4868
parent143239e143d57c550e949fb3fcc4540de7c8d354 (diff)
downloadopenrc-dcdfdb442f436cd1f1bdfdc46622f5d6f48f8061.tar.gz
openrc-dcdfdb442f436cd1f1bdfdc46622f5d6f48f8061.tar.bz2
openrc-dcdfdb442f436cd1f1bdfdc46622f5d6f48f8061.tar.xz
Some systems are only detectable after /proc is mounted, so re-test if unknown.
-rw-r--r--sh/init.sh.Linux.in3
-rw-r--r--src/rc/rc.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 25a3ecb..5aa5031 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -96,6 +96,9 @@ if ${mountproc}; then
fi
unset mountproc
+# Re-load RC_SYS if empty now we have /proc mounted
+[ -z "${RC_SYS}" ] && export RC_SYS="$(rc --sys)"
+
# Read off the kernel commandline to see if there's any special settings
# especially check to see if we need to set the CDBOOT environment variable
# Note: /proc MUST be mounted
diff --git a/src/rc/rc.c b/src/rc/rc.c
index b305b2d..5ae7e1f 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -935,11 +935,13 @@ static void handle_bad_signal(int sig)
static const struct option longopts[] = {
{ "override", 1, NULL, 'o' },
{ "service", 1, NULL, 's' },
+ { "sys", 0, NULL, 'S' },
longopts_COMMON
};
static const char * const longopts_help[] = {
"override the next runlevel to change into\nwhen leaving single user or boot runlevels",
"runs the service specified with the rest\nof the arguments",
+ "output the RC system type, if any",
longopts_help_COMMON
};
#include "_usage.c"
@@ -1028,6 +1030,12 @@ int main(int argc, char **argv)
execv(*argv, argv);
eerrorx("%s: %s", applet, strerror(errno));
/* NOTREACHED */
+ case 'S':
+ bootlevel = rc_sys();
+ if (bootlevel)
+ printf("%s\n", bootlevel);
+ exit(EXIT_SUCCESS);
+ /* NOTREACHED */
case_RC_COMMON_GETOPT
}
}