1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
function yesno() {
ANS=
VAL=$(eval "echo \"\${$1}\"")
HELP=$(eval "echo \"\${${1}_HELP}\"")
if test "$VAL" = "y" -o "$VAL" = "m"; then
PROMPT="[Y/n]"
VAL="y"
else
PROMPT="[y/N]"
VAL="n"
fi
while test "$ANS" != "y" -a "$ANS" != "n"
do
echo -n "$HELP $PROMPT ? "
read ANS
case "$ANS" in
"" ) ANS="$VAL";;
[yY] | [Yy]es | YES ) ANS="y";;
[nN] | [Nn]o | NO ) ANS="n";;
esac
done
eval "$1"="$ANS"
}
function yesno_dep() {
DEP=$(eval "echo \"\${$2}\"")
if test "$DEP" != n; then
yesno "$1"
fi
}
function yesmodno() {
if [ $CONF__MODULES = n ]; then
yesno "$1"
else
ANS=
VAL=$(eval "echo \"\${$1}\"")
HELP=$(eval "echo \"\${${1}_HELP}\"")
if test "$VAL" = "y"; then
PROMPT="[Y/m/n]"
elif test "$VAL" = "m"; then
PROMPT="[y/M/n]"
else
PROMPT="[y/m/N]"
VAL="n"
fi
while test "$ANS" != "y" -a "$ANS" != "m" -a "$ANS" != "n"
do
echo -n "$HELP $PROMPT ? "
read ANS
case "$ANS" in
"" ) ANS="$VAL";;
[yY] | [Yy]es | YES ) ANS="y";;
[mM] | [Mm]od | MOD ) ANS="m";;
[nN] | [Nn]o | NO ) ANS="n";;
esac
done
eval "$1=$ANS"
fi
}
function yesmodno_dep() {
DEP=$(eval "echo \"\${$2}\"")
if test "$DEP" != n; then
yesmodno "$1"
fi
}
function yesno_truedep() {
DEP=$(eval "echo \"\${$2}\"")
if test "$DEP" != n; then
yesno "$1"
else
eval "$1=n"
fi
}
function yesmodno_truedep() {
DEP=$(eval "echo \"\${$2}\"")
if test "$DEP" != n; then
yesmodno "$1"
else
eval "$1=n"
fi
}
function msg() {
echo "# $1"
}
function menu() {
echo -e "#\n# "$(eval "echo \"\${${1}_MENU}\"")"\n#"
}
function endmenu() {
:
}
function dump() {
VAL=$(eval "echo \"\${$1}\"")
echo "$1=$VAL"
}
echo "#"
echo "# Twin configuration utility"
echo "#"
if [ -f conf/conf.current -a -f conf/conf.auto -a conf/conf.current -ot conf/conf.auto ]; then
echo "# Using configuration generated by './configure' saved in conf.auto"
source conf/conf.auto
elif [ -f conf/conf.current ]; then
echo "# Using configuration saved in conf.current"
source conf/conf.current
elif [ -f conf/conf.auto ]; then
echo "# Using configuration generated by './configure' saved in conf.auto"
source conf/conf.auto
else
echo "# Using default configuration from conf.default"
source conf/conf.default
fi
source conf/conf.base
cat >conf/conf.current <<EOF
#
# This file holds the current configuration.
# It was created by 'make config', do not edit!
#
# Configuration:
#
EOF
for i in `cat conf/conf.list`; do
dump $i
done >>conf/conf.current
|