From c07b384d82f78959adc96fbbbef72cae5bf3c272 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 24 Apr 2009 11:49:55 +0000 Subject: Don't drop to sulogin by default, but make this configurable. --- etc/rc.conf.in | 20 ++++++++++++-------- src/rc/rc.c | 24 +++++++++++------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/etc/rc.conf.in b/etc/rc.conf.in index fa28d86..173ed90 100644 --- a/etc/rc.conf.in +++ b/etc/rc.conf.in @@ -7,12 +7,16 @@ # WARNING: whilst we have improved parallel, it can still potentially lock # the boot process. Don't file bugs about this unless you can supply # 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 # boot so you can choose to start specific services. Set to "NO" to disable # 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 # 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 # one comes up. With rc_depend_strict="YES" we would require them both to # come up. -rc_depend_strict="YES" +#rc_depend_strict="YES" # rc_hotplug is a list of services that we allow to be hotplugged. # By default we do not allow hotplugging. @@ -38,11 +42,11 @@ rc_depend_strict="YES" # /var/log/rc.log # NOTE: Linux systems require the devfs service to be started before # 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 # 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. # 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 # waits to check that the daemon is still running after starting here. # 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. # This still allows the service itself to be stopped when called directly. #rc_nostop="network" @@ -68,7 +72,7 @@ rc_logger="NO" # There variables are shared between many init scripts # Set unicode to YES to turn on unicode support for keyboards and screens. -unicode="NO" +#unicode="NO" # Network fstypes. Below is the default. net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" diff --git a/src/rc/rc.c b/src/rc/rc.c index 83a3701..56d6d58 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -299,7 +299,7 @@ run_program(const char *prog) if (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, strerror(errno)); _exit(EXIT_FAILURE); @@ -312,12 +312,14 @@ run_program(const char *prog) } static void -sulogin(bool cont) +open_shell(void) { + const char *shell; + #ifdef __linux__ const char *sys = rc_sys(); - /* VSERVER and OPENVZ systems cannot do a sulogin */ + /* VSERVER and OPENVZ systems cannot really drop to shells */ if (sys && (strcmp(sys, "VSERVER") == 0 || strcmp(sys, "OPENVZ") == 0)) { @@ -326,15 +328,11 @@ sulogin(bool cont) applet, strerror(errno)); } #endif - if (!cont) { - rc_logger_close(); - exit(EXIT_SUCCESS); - } -#ifdef __linux__ - run_program(SULOGIN); -#else - run_program("/bin/sh"); -#endif + + shell = rc_conf_value("rc_shell"); + if (shell == NULL) + shell = "/bin/sh"; + run_program(shell); } _dead static void @@ -695,7 +693,7 @@ do_start_services(bool parallel) case '1': break; case '2': continue; case '3': interactive = false; break; - case '4': sulogin(true); goto interactive_retry; + case '4': open_shell(); goto interactive_retry; default: goto interactive_option; } } -- cgit v1.2.3