Check whether interactive wifi settings are complete

This commit is contained in:
Bob Mottram 2016-10-15 10:26:30 +01:00
parent badc22ea4e
commit a253b3b65f
1 changed files with 16 additions and 4 deletions

View File

@ -241,7 +241,7 @@ function networks_from_file {
fi
if [ $ctr -eq 1 ]; then
WIFI_TYPE="$line"
if [[ $WIFI_TYPE == $'none' || $WIFI_TYPE == $'None' ]]; then
if [[ $WIFI_TYPE == $'none' || $WIFI_TYPE == $'open' ]]; then
echo 'network={' >> $WIFI_CONFIG
echo " ssid=\"${WIFI_SSID}\"" >> $WIFI_CONFIG
echo ' key_mgmt=NONE' >> $WIFI_CONFIG
@ -321,6 +321,18 @@ function create_networks_interactive {
echo "$WIFI_PASSPHRASE" >> $WIFI_NETWORKS_FILE
fi
if [ ${#WIFI_SSID} -gt 1 ]; then
if [ ${#WIFI_TYPE} -gt 1 ]; then
if [[ "${#WIFI_TYPE}" == $'none' || "${#WIFI_TYPE}" == $'open' ]]; then
wifi_networks_done='yes'
else
if [ ${#WIFI_PASSPHRASE} -gt 1 ]; then
wifi_networks_done='yes'
fi
fi
fi
fi
# clear values
WIFI_SSID=
WIFI_PASSPHRASE=
@ -350,7 +362,7 @@ function show_help {
echo ''
echo $' --help Show help'
echo $' -i --interface [wlan0|wlan1...] Device name'
echo $' -t --type [wpa2-psk|none] Security type'
echo $' -t --type [wpa2-psk|none|open] Security type'
echo $' -s --ssid [id] Set SSID'
echo $' -p --passphrase [text] Set passphrase'
echo $' --hotspot [yes|no] Create a hotspot'
@ -441,7 +453,7 @@ else
hotspot_off
fi
if [[ $WIFI_TYPE != 'none' ]]; then
if [[ "$WIFI_TYPE" != 'none' && "$WIFI_TYPE" != 'open' ]]; then
if [ ! $WIFI_PASSPHRASE ]; then
echo $'No wifi passphrase was given'
exit 2
@ -457,7 +469,7 @@ if [[ $WIFI_TYPE == 'wpa2-psk' ]]; then
exit 0
fi
if [[ $WIFI_TYPE == 'none' ]]; then
if [[ "$WIFI_TYPE" == 'none' || "$WIFI_TYPE" == 'open' ]]; then
wifi_none "$WIFI_SSID"
exit 0
fi