setup hotspot during install

This commit is contained in:
Bob Mottram 2016-04-21 14:14:38 +01:00
parent fdbefe3eea
commit 6a4c2208f5
2 changed files with 186 additions and 176 deletions

View File

@ -106,6 +106,7 @@ WIFI_INTERFACE=wlan0
WIFI_TYPE='wpa2-psk'
WIFI_SSID=
WIFI_PASSPHRASE=
WIFI_HOTSPOT=
BATMAN_CELLID='any'
WIFI_CHANNEL=
CONFIGURATION_FILE=
@ -303,6 +304,9 @@ function save_configuration_file {
if [ ${#WIFI_PASSPHRASE} -gt 1 ]; then
echo "WIFI_PASSPHRASE=$WIFI_PASSPHRASE" >> $CONFIGURATION_FILE
fi
if [ $WIFI_HOTSPOT ]; then
echo "WIFI_HOTSPOT=$WIFI_HOTSPOT" >> $CONFIGURATION_FILE
fi
if [ $BATMAN_CELLID ]; then
echo "BATMAN_CELLID=$BATMAN_CELLID" >> $CONFIGURATION_FILE
fi
@ -1326,11 +1330,12 @@ function interactive_configuration {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--title $"Wifi setup" \
--form $"\nIf you wish to use wifi rather than wired ethernet then enter the details below, otherwise just select Ok:" 15 55 5 \
--form $"\nIf you wish to use wifi rather than wired ethernet then enter the details below, otherwise just select Ok:" 16 55 6 \
$"Interface:" 1 1 "$WIFI_INTERFACE" 1 16 16 15 \
$"SSID:" 2 1 "$WIFI_SSID" 2 16 30 30 \
$"Type:" 3 1 "$WIFI_TYPE" 3 16 16 15 \
$"Passphrase:" 4 1 "$WIFI_PASSPHRASE" 4 16 30 30 \
$"Hotspot:" 5 1 "$WIFI_HOTSPOT" 5 16 16 15 \
2> $data
sel=$?
case $sel in
@ -1341,6 +1346,12 @@ function interactive_configuration {
WIFI_SSID=$(cat $data | sed -n 2p)
WIFI_TYPE=$(cat $data | sed -n 3p)
WIFI_PASSPHRASE=$(cat $data | sed -n 4p)
WIFI_HOTSPOT=$(cat $data | sed -n 5p)
if [[ $WIFI_HOTSPOT == $'Y' || $WIFI_HOTSPOT == $'y' || $WIFI_HOTSPOT == $'yes' || $WIFI_HOTSPOT == $'Yes' || $WIFI_HOTSPOT == $'true' || $WIFI_HOTSPOT == $'on' || $WIFI_HOTSPOT == $'True' || $WIFI_HOTSPOT == '1' ]]; then
WIFI_HOTSPOT='yes'
else
WIFI_HOTSPOT='no'
fi
save_configuration_file
fi
@ -1955,9 +1966,9 @@ function interactive_configuration {
if [ -f temp.cfg ]; then
shred -zu temp.cfg
fi
}
}
function show_result {
function show_result {
#clear
echo ''
echo -n $"Configuration filename:"
@ -1967,9 +1978,9 @@ function show_result {
echo ''
cat $CONFIGURATION_FILE
echo ''
}
}
function read_configuration {
function read_configuration {
if [ ! $CONFIGURATION_FILE ]; then
CONFIGURATION_FILE='freedombone.cfg'
fi

View File

@ -1717,8 +1717,7 @@ function wifi_settings {
fi
HOTSPOT='no'
if [[ $NEW_WIFI_HOTSPOT == $'Y' || $NEW_WIFI_HOTSPOT == $'yes' || $NEW_WIFI_HOTSPOT == $'y' ]]; then
apt-get -y install hostapd bridge-utils
if [[ $NEW_WIFI_HOTSPOT == $'Y' || $NEW_WIFI_HOTSPOT == $'y' || $NEW_WIFI_HOTSPOT == $'yes' || $NEW_WIFI_HOTSPOT == $'Yes' || $NEW_WIFI_HOTSPOT == $'true' || $NEW_WIFI_HOTSPOT == $'on' || $NEW_WIFI_HOTSPOT == $'True' || $NEW_WIFI_HOTSPOT == '1' ]]; then
HOTSPOT='yes'
fi