Some systems are only detectable after /proc is mounted, so re-test if unknown.

This commit is contained in:
Roy Marples 2008-04-06 20:06:07 +00:00
parent 143239e143
commit dcdfdb442f
2 changed files with 11 additions and 0 deletions

View File

@ -96,6 +96,9 @@ if ${mountproc}; then
fi fi
unset mountproc 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 # 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 # especially check to see if we need to set the CDBOOT environment variable
# Note: /proc MUST be mounted # Note: /proc MUST be mounted

View File

@ -935,11 +935,13 @@ static void handle_bad_signal(int sig)
static const struct option longopts[] = { static const struct option longopts[] = {
{ "override", 1, NULL, 'o' }, { "override", 1, NULL, 'o' },
{ "service", 1, NULL, 's' }, { "service", 1, NULL, 's' },
{ "sys", 0, NULL, 'S' },
longopts_COMMON longopts_COMMON
}; };
static const char * const longopts_help[] = { static const char * const longopts_help[] = {
"override the next runlevel to change into\nwhen leaving single user or boot runlevels", "override the next runlevel to change into\nwhen leaving single user or boot runlevels",
"runs the service specified with the rest\nof the arguments", "runs the service specified with the rest\nof the arguments",
"output the RC system type, if any",
longopts_help_COMMON longopts_help_COMMON
}; };
#include "_usage.c" #include "_usage.c"
@ -1028,6 +1030,12 @@ int main(int argc, char **argv)
execv(*argv, argv); execv(*argv, argv);
eerrorx("%s: %s", applet, strerror(errno)); eerrorx("%s: %s", applet, strerror(errno));
/* NOTREACHED */ /* NOTREACHED */
case 'S':
bootlevel = rc_sys();
if (bootlevel)
printf("%s\n", bootlevel);
exit(EXIT_SUCCESS);
/* NOTREACHED */
case_RC_COMMON_GETOPT case_RC_COMMON_GETOPT
} }
} }