Mon Nov 1 14:42:08 2010 UTC ()
From Anon Ymous:
Send the SIGALRM to the correct process when we timeout. See the note
in src/etc/rc regarding RC_PID.

The former code would leave you with a root shell when the prompt
timed out (if the tty is marked secure) while continuing the boot
process in another shell.  This was easily hidden if you started
xdm(1) at boot, while the root shell remains on another tty
(accessible with CTL-ALT-F1).


(christos)
diff -r1.13 -r1.14 src/etc/rc.d/bootconf.sh

cvs diff -r1.13 -r1.14 src/etc/rc.d/bootconf.sh (expand / switch to unified diff)

--- src/etc/rc.d/bootconf.sh 2009/09/12 17:40:01 1.13
+++ src/etc/rc.d/bootconf.sh 2010/11/01 14:42:08 1.14
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: bootconf.sh,v 1.13 2009/09/12 17:40:01 apb Exp $ 3# $NetBSD: bootconf.sh,v 1.14 2010/11/01 14:42:08 christos Exp $
4# 4#
5 5
6# PROVIDE: bootconf 6# PROVIDE: bootconf
7# REQUIRE: mountcritlocal 7# REQUIRE: mountcritlocal
8# KEYWORD: interactive 8# KEYWORD: interactive
9 9
10$_rc_subr_loaded . /etc/rc.subr 10$_rc_subr_loaded . /etc/rc.subr
11 11
12name="bootconf" 12name="bootconf"
13start_cmd="bootconf_start" 13start_cmd="bootconf_start"
14stop_cmd=":" 14stop_cmd=":"
15 15
16bootconf_start() 16bootconf_start()
@@ -40,33 +40,32 @@ bootconf_start() @@ -40,33 +40,32 @@ bootconf_start()
40 continue 40 continue
41 ;;  41 ;;
42 *) 42 *)
43 if [ "$name" = "$default" ]; then 43 if [ "$name" = "$default" ]; then
44 echo -n "${spc}[${name}]" 44 echo -n "${spc}[${name}]"
45 else 45 else
46 echo -n "${spc}${name}" 46 echo -n "${spc}${name}"
47 fi 47 fi
48 spc=" " 48 spc=" "
49 ;; 49 ;;
50 esac 50 esac
51 done 51 done
52 echo 52 echo
53 master=$$ 
54 _DUMMY=/etc/passwd 53 _DUMMY=/etc/passwd
55 conf=${_DUMMY} 54 conf=${_DUMMY}
56 while [ ! -d /etc/etc.$conf/. ]; do 55 while [ ! -d /etc/etc.$conf/. ]; do
57 trap "conf=$default; echo; echo Using default of $default" ALRM 56 trap "conf=$default; echo; echo Using default of $default" ALRM
58 echo -n "Which configuration [$default] ? " 57 echo -n "Which configuration [$default] ? "
59 (sleep 30 && kill -ALRM $master) >/dev/null 2>&1 & 58 (sleep 30 && kill -ALRM $RC_PID) >/dev/null 2>&1 &
60 read conf 59 read conf
61 trap : ALRM 60 trap : ALRM
62 if [ -z $conf ] ; then 61 if [ -z $conf ] ; then
63 conf=$default 62 conf=$default
64 fi 63 fi
65 if [ ! -d /etc/etc.$conf/. ]; then 64 if [ ! -d /etc/etc.$conf/. ]; then
66 conf=${_DUMMY} 65 conf=${_DUMMY}
67 fi 66 fi
68 done 67 done
69 68
70 print_rc_metadata "note:Using configuration \"${conf}\"" 69 print_rc_metadata "note:Using configuration \"${conf}\""
71 70
72 case $conf in 71 case $conf in