2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: bootconf.sh,v 1.5 2002/03/25 03:22:10 wiz Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: bootconf
|
|
|
|
# REQUIRE: mountcritlocal
|
|
|
|
|
|
|
|
bootconf_start()
|
|
|
|
{
|
|
|
|
# Refer to newbtconf(8) for more information
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ ! -e /etc/etc.current ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
2002-10-01 13:29:45 +00:00
|
|
|
if [ -L /etc/etc.default ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
def=`ls -ld /etc/etc.default 2>&1`
|
|
|
|
default="${def##*-> etc.}"
|
|
|
|
else
|
|
|
|
default=current
|
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
if [ "$default" = "current" ]; then
|
|
|
|
def=`ls -ld /etc/etc.current 2>&1`
|
|
|
|
default="${def##*-> etc.}"
|
|
|
|
fi
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
spc=""
|
2002-06-13 22:14:37 +00:00
|
|
|
for i in /etc/etc.*; do
|
2001-06-16 07:16:14 +00:00
|
|
|
name="${i##/etc/etc.}"
|
|
|
|
case $name in
|
|
|
|
current|default|\*)
|
|
|
|
continue
|
2002-10-12 10:31:31 +00:00
|
|
|
;;
|
2001-06-16 07:16:14 +00:00
|
|
|
*)
|
|
|
|
if [ "$name" = "$default" ]; then
|
|
|
|
echo -n "${spc}[${name}]"
|
|
|
|
else
|
|
|
|
echo -n "${spc}${name}"
|
|
|
|
fi
|
|
|
|
spc=" "
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
master=$$
|
2006-12-30 22:53:20 +00:00
|
|
|
DUMMY=/etc/passwd
|
|
|
|
conf=${DUMMY}
|
2001-06-16 07:16:14 +00:00
|
|
|
while [ ! -d /etc/etc.$conf/. ]; do
|
2002-06-13 22:14:37 +00:00
|
|
|
trap "conf=$default; echo; echo Using default of $conf" ALRM
|
2001-06-16 07:16:14 +00:00
|
|
|
echo -n "Which configuration [$default] ? "
|
|
|
|
(sleep 30 && kill -ALRM $master) >/dev/null 2>&1 &
|
|
|
|
read conf
|
2002-06-13 22:14:37 +00:00
|
|
|
trap : ALRM
|
2002-10-12 10:31:31 +00:00
|
|
|
if [ -z $conf ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
conf=$default
|
|
|
|
fi
|
|
|
|
if [ ! -d /etc/etc.$conf/. ]; then
|
2006-12-30 22:53:20 +00:00
|
|
|
conf=${DUMMY}
|
2001-06-16 07:16:14 +00:00
|
|
|
fi
|
|
|
|
done
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
case $conf in
|
|
|
|
current|default)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
rm -f /etc/etc.current
|
|
|
|
ln -s /etc/etc.$conf /etc/etc.current
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2002-10-12 10:31:31 +00:00
|
|
|
if [ -f /etc/rc.conf ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
. /etc/rc.conf
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
*start)
|
|
|
|
bootconf_start
|
|
|
|
;;
|
|
|
|
esac
|