Wifi configuration in interactive installer

This commit is contained in:
Bob Mottram 2015-07-26 14:09:17 +01:00
parent 552bd5f967
commit b584dbcad7
1 changed files with 45 additions and 1 deletions

View File

@ -90,7 +90,9 @@ MEDIAGOBLIN_CODE=
USB_DRIVE=/dev/sdb1
HWRNG_TYPE=
ENABLE_SOCIAL_KEY_MANAGEMENT=
ESSID='mesh'
BATMAN_CELLID='02:BA:00:00:03:01'
WIFI_CHANNEL=
CONFIGURATION_FILE=
function show_help {
@ -231,6 +233,15 @@ function save_configuration_file {
if [ $ENABLE_SOCIAL_KEY_MANAGEMENT ]; then
echo "ENABLE_SOCIAL_KEY_MANAGEMENT=$ENABLE_SOCIAL_KEY_MANAGEMENT" >> $CONFIGURATION_FILE
fi
if [ $ESSID ]; then
echo "ESSID=$ESSID" >> $CONFIGURATION_FILE
fi
if [ $BATMAN_CELLID ]; then
echo "BATMAN_CELLID=$BATMAN_CELLID" >> $CONFIGURATION_FILE
fi
if [ $WIFI_CHANNEL ]; then
echo "WIFI_CHANNEL=$WIFI_CHANNEL" >> $CONFIGURATION_FILE
fi
}
# test a domain name to see if it's valid
@ -526,6 +537,30 @@ function interactive_configuration {
3) ENABLE_CJDNS="yes";;
esac
save_configuration_file
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Wireless Mesh ESSID\n\nIf you press enter the default will be '$ESSID'" 10 40 "$(grep 'ESSID' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) ESSID=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
fi
if [[ $ENABLE_BATMAN == "yes" ]]; then
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Wireless Mesh cell ID\n\nIf you press enter the default will be $BATMAN_CELLID" 10 40 "$(grep 'BATMAN_CELLID' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) BATMAN_CELLID=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
fi
data=$(tempfile 2>/dev/null)
@ -1470,6 +1505,15 @@ function read_configuration {
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "ESSID" $CONFIGURATION_FILE; then
ESSID=$(grep "ESSID" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "BATMAN_CELLID" $CONFIGURATION_FILE; then
BATMAN_CELLID=$(grep "BATMAN_CELLID" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIFI_CHANNEL" $CONFIGURATION_FILE; then
WIFI_CHANNEL=$(grep "WIFI_CHANNEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
fi
}