1 #!/bin/sh 2 # 3 # $NetBSD: bootconf.sh,v 1.2 2000/08/21 23:34:45 lukem Exp $ 4 # 5 6 # PROVIDE: bootconf 7 # REQUIRE: mountcritlocal 8 9 bootconf_start() 10 { 11 # Refer to newbtconf(8) for more information 12 # 13 14 if [ ! -e /etc/etc.current ]; then 15 return 0 16 fi 17 if [ -h /etc/etc.default ]; then 18 def=`ls -ld /etc/etc.default 2>&1` 19 default=`expr "$def" : '.*-> etc\.\(.*\)' 2>&1` 20 else 21 default=current 22 fi 23 spc="" 24 conflist=`cd /etc; ls -1d etc.* 2>&1 | egrep -v "current|default"` 25 for i in $conflist; do 26 name=${i#etc.} 27 if [ "$name" = "$default" ]; then 28 echo -n "${spc}[${name}]" 29 else 30 echo -n "${spc}${name}" 31 fi 32 spc=" " 33 done 34 echo 35 master=$$ 36 _DUMMY=/etc/passwd 37 conf=${_DUMMY} 38 while [ ! -d /etc/etc.$conf/. ]; do 39 trap "conf=$default; echo; echo Using default of $conf" 14 40 echo -n "Which configuration [$default] ? " 41 (sleep 30 && kill -ALRM $master) >/dev/null 2>&1 & 42 read conf 43 trap : 14 44 if [ -z $conf ] ; then 45 conf=$default 46 fi 47 if [ ! -d /etc/etc.$conf/. ]; then 48 conf=${_DUMMY} 49 fi 50 done 51 rm -f /etc/etc.current 52 ln -s /etc/etc.$conf /etc/etc.current 53 if [ -f /etc/rc.conf ] ; then 54 . /etc/rc.conf 55 fi 56 } 57 58 case "$1" in 59 *start) 60 bootconf_start 61 ;; 62 esac 63