Don't drop to sulogin by default, but make this configurable.

This commit is contained in:
Roy Marples 2009-04-24 11:49:55 +00:00
parent bd211d534b
commit c07b384d82
2 changed files with 23 additions and 21 deletions

View File

@ -7,12 +7,16 @@
# WARNING: whilst we have improved parallel, it can still potentially lock # WARNING: whilst we have improved parallel, it can still potentially lock
# the boot process. Don't file bugs about this unless you can supply # the boot process. Don't file bugs about this unless you can supply
# patches that fix it without breaking other things! # patches that fix it without breaking other things!
rc_parallel="NO" #rc_parallel="NO"
# Set rc_interactive to "YES" and you'll be able to press the I key during # Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable # boot so you can choose to start specific services. Set to "NO" to disable
# this feature. # this feature.
rc_interactive="YES" #rc_interactive="YES"
# If we need to drop to a shell, you can specify it here.
# Linux users could specify /sbin/sulogin
#rc_shell=/bin/sh
# Do we allow any started service in the runlevel to satisfy the depedency # Do we allow any started service in the runlevel to satisfy the depedency
# or do we want all of them regardless of state? For example, if net.eth0 # or do we want all of them regardless of state? For example, if net.eth0
@ -20,7 +24,7 @@ rc_interactive="YES"
# both will be started, but services that depend on 'net' will work if either # both will be started, but services that depend on 'net' will work if either
# one comes up. With rc_depend_strict="YES" we would require them both to # one comes up. With rc_depend_strict="YES" we would require them both to
# come up. # come up.
rc_depend_strict="YES" #rc_depend_strict="YES"
# rc_hotplug is a list of services that we allow to be hotplugged. # rc_hotplug is a list of services that we allow to be hotplugged.
# By default we do not allow hotplugging. # By default we do not allow hotplugging.
@ -38,11 +42,11 @@ rc_depend_strict="YES"
# /var/log/rc.log # /var/log/rc.log
# NOTE: Linux systems require the devfs service to be started before # NOTE: Linux systems require the devfs service to be started before
# logging can take place and as such cannot log the sysinit runlevel. # logging can take place and as such cannot log the sysinit runlevel.
rc_logger="NO" #rc_logger="YES"
# By default we filter the environment for our running scripts. To allow other # By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through. # variables through, add them here. Use a * to allow all variables through.
# rc_env_allow="VAR1 VAR2" #rc_env_allow="VAR1 VAR2"
# By default we assume that all daemons will start correctly. # By default we assume that all daemons will start correctly.
# However, some do not - a classic example is that they fork and return 0 AND # However, some do not - a classic example is that they fork and return 0 AND
@ -50,9 +54,9 @@ rc_logger="NO"
# child crashes. You can set the number of milliseconds start-stop-daemon # child crashes. You can set the number of milliseconds start-stop-daemon
# waits to check that the daemon is still running after starting here. # waits to check that the daemon is still running after starting here.
# The default is 0 - no checking. # The default is 0 - no checking.
# rc_start_wait=100 #rc_start_wait=100
# rc_nostop is a list of services that rc will not stop when changing runlevels. # rc_nostop is a list of services which will not stop when changing runlevels.
# Network clients may wish to add network to the list. # Network clients may wish to add network to the list.
# This still allows the service itself to be stopped when called directly. # This still allows the service itself to be stopped when called directly.
#rc_nostop="network" #rc_nostop="network"
@ -68,7 +72,7 @@ rc_logger="NO"
# There variables are shared between many init scripts # There variables are shared between many init scripts
# Set unicode to YES to turn on unicode support for keyboards and screens. # Set unicode to YES to turn on unicode support for keyboards and screens.
unicode="NO" #unicode="NO"
# Network fstypes. Below is the default. # Network fstypes. Below is the default.
net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"

View File

@ -299,7 +299,7 @@ run_program(const char *prog)
if (termios_orig) if (termios_orig)
tcsetattr(STDIN_FILENO, TCSANOW, termios_orig); tcsetattr(STDIN_FILENO, TCSANOW, termios_orig);
execl(prog, prog, (char *) NULL); execl(prog, prog, (char *)NULL);
eerror("%s: unable to exec `%s': %s", applet, prog, eerror("%s: unable to exec `%s': %s", applet, prog,
strerror(errno)); strerror(errno));
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
@ -312,12 +312,14 @@ run_program(const char *prog)
} }
static void static void
sulogin(bool cont) open_shell(void)
{ {
const char *shell;
#ifdef __linux__ #ifdef __linux__
const char *sys = rc_sys(); const char *sys = rc_sys();
/* VSERVER and OPENVZ systems cannot do a sulogin */ /* VSERVER and OPENVZ systems cannot really drop to shells */
if (sys && if (sys &&
(strcmp(sys, "VSERVER") == 0 || strcmp(sys, "OPENVZ") == 0)) (strcmp(sys, "VSERVER") == 0 || strcmp(sys, "OPENVZ") == 0))
{ {
@ -326,15 +328,11 @@ sulogin(bool cont)
applet, strerror(errno)); applet, strerror(errno));
} }
#endif #endif
if (!cont) {
rc_logger_close(); shell = rc_conf_value("rc_shell");
exit(EXIT_SUCCESS); if (shell == NULL)
} shell = "/bin/sh";
#ifdef __linux__ run_program(shell);
run_program(SULOGIN);
#else
run_program("/bin/sh");
#endif
} }
_dead static void _dead static void
@ -695,7 +693,7 @@ do_start_services(bool parallel)
case '1': break; case '1': break;
case '2': continue; case '2': continue;
case '3': interactive = false; break; case '3': interactive = false; break;
case '4': sulogin(true); goto interactive_retry; case '4': open_shell(); goto interactive_retry;
default: goto interactive_option; default: goto interactive_option;
} }
} }