From a253b3b65fcf9f35930a147829434caf8ec17dca Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 15 Oct 2016 10:26:30 +0100 Subject: [PATCH] Check whether interactive wifi settings are complete --- src/freedombone-wifi | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/freedombone-wifi b/src/freedombone-wifi index 1de9ac72..c59e7107 100755 --- a/src/freedombone-wifi +++ b/src/freedombone-wifi @@ -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