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