hotspot setup during install

This commit is contained in:
Bob Mottram 2016-04-21 14:07:39 +01:00
parent 1189d07005
commit fdbefe3eea
1 changed files with 12 additions and 2 deletions

View File

@ -444,6 +444,7 @@ WIFI_INTERFACE=wlan0
WIFI_TYPE='wpa2-psk'
WIFI_SSID=
WIFI_PASSPHRASE=
WIFI_HOTSPOT='no'
# cjdns settings
ENABLE_CJDNS="no"
@ -1075,6 +1076,9 @@ function read_configuration {
if grep -q "WIFI_PASSPHRASE" $CONFIGURATION_FILE; then
WIFI_PASSPHRASE=$(grep "WIFI_PASSPHRASE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIFI_HOTSPOT" $CONFIGURATION_FILE; then
WIFI_HOTSPOT=$(grep "WIFI_HOTSPOT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "SYNCTHING_ID" $CONFIGURATION_FILE; then
SYNCTHING_ID=$(grep "SYNCTHING_ID" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -1725,6 +1729,12 @@ function setup_wifi {
if grep -Fxq "setup_wifi" $COMPLETION_FILE; then
return
fi
HOTSPOT='no'
if [[ $WIFI_HOTSPOT != 'no' ]]; then
HOTSPOT='yes'
fi
if [[ $WIFI_TYPE != 'none' ]]; then
if [ ! $WIFI_PASSPHRASE ]; then
echo $'No wifi passphrase was given'
@ -1734,9 +1744,9 @@ function setup_wifi {
echo $'Wifi passphrase was too short'
return
fi
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $HOTSPOT
else
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT
fi
echo 'setup_wifi' >> $COMPLETION_FILE
}