Skip to content
Snippets Groups Projects
Commit a253b3b6 authored by Bob Mottram's avatar Bob Mottram
Browse files

Check whether interactive wifi settings are complete

parent badc22ea
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment