etc/services - sync with NetBSD-8
[minix.git] / etc / rc.d / bootconf.sh
blob1e2defa82a90942ef0c9c72fe4e3234dfcf5627d
1 #!/bin/sh
3 # $NetBSD: bootconf.sh,v 1.15 2012/12/31 23:21:27 christos Exp $
6 # PROVIDE: bootconf
7 # REQUIRE: mountcritlocal
8 # KEYWORD: interactive
10 $_rc_subr_loaded . /etc/rc.subr
12 name="bootconf"
13 start_cmd="bootconf_start"
14 stop_cmd=":"
16 bootconf_start()
18 # Refer to newbtconf(8) for more information
21 if [ ! -e /etc/etc.current ]; then
22 return 0
24 if [ -h /etc/etc.default ]; then
25 def=$(ls -ld /etc/etc.default 2>&1)
26 default="${def##*-> *etc.}"
27 else
28 default=current
30 if [ "$default" = "current" ]; then
31 def=$(ls -ld /etc/etc.current 2>&1)
32 default="${def##*-> *etc.}"
35 spc=""
36 for i in /etc/etc.*; do
37 name="${i##/etc/etc.}"
38 case $name in
39 current|default|\*)
40 continue
41 ;;
43 if [ "$name" = "$default" ]; then
44 echo -n "${spc}[${name}]"
45 else
46 echo -n "${spc}${name}"
48 spc=" "
50 esac
51 done
52 echo
53 _DUMMY=/etc/passwd
54 conf=${_DUMMY}
55 while [ ! -d /etc/etc.$conf/. ]; do
56 trap "conf=$default; echo; echo Using default of $default" ALRM
57 echo -n "Which configuration [$default] ? "
58 (sleep 30 && kill -ALRM $RC_PID) >/dev/null 2>&1 &
59 read conf
60 trap : ALRM
61 if [ -z $conf ] ; then
62 conf=$default
64 if [ ! -d /etc/etc.$conf/. ]; then
65 conf=${_DUMMY}
67 done
69 print_rc_metadata "note:Using configuration \"${conf}\""
71 case $conf in
72 current|default)
75 rm -f /etc/etc.current
76 ln -s etc.$conf /etc/etc.current
77 sync
79 esac
81 if [ -f /etc/rc.conf ] ; then
82 . /etc/rc.conf
86 load_rc_config $name
87 run_rc_command "$1"