Only create wifi networks file if necessary
This commit is contained in:
parent
95b0b9c8af
commit
309dbc06fb
|
@ -452,6 +452,18 @@ function networks_from_file {
|
||||||
ifconfig ${WIFI_INTERFACE} up
|
ifconfig ${WIFI_INTERFACE} up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wifi_networks_file_header {
|
||||||
|
echo $'# Add wifi networks as follows:' > $WIFI_NETWORKS_FILE
|
||||||
|
echo '#' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo $'# MySSID' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo $'# wpa2-psk' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo $'# myWifiPassphrase' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo '#' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo $'# AnotherSSID' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo $'# none' >> $WIFI_NETWORKS_FILE
|
||||||
|
echo '#' >> $WIFI_NETWORKS_FILE
|
||||||
|
}
|
||||||
|
|
||||||
function create_networks_interactive {
|
function create_networks_interactive {
|
||||||
remove_config_param "WIFI_INTERFACE"
|
remove_config_param "WIFI_INTERFACE"
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors
|
||||||
|
@ -464,16 +476,6 @@ function create_networks_interactive {
|
||||||
rm $WIFI_NETWORKS_FILE
|
rm $WIFI_NETWORKS_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $'# Add wifi networks as follows:' > $WIFI_NETWORKS_FILE
|
|
||||||
echo '#' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo $'# MySSID' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo $'# wpa2-psk' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo $'# myWifiPassphrase' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo '#' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo $'# AnotherSSID' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo $'# none' >> $WIFI_NETWORKS_FILE
|
|
||||||
echo '#' >> $WIFI_NETWORKS_FILE
|
|
||||||
|
|
||||||
# By default connect to any open wifi
|
# By default connect to any open wifi
|
||||||
WIFI_SSID=''
|
WIFI_SSID=''
|
||||||
WIFI_TYPE=$'open'
|
WIFI_TYPE=$'open'
|
||||||
|
@ -510,6 +512,10 @@ function create_networks_interactive {
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $WIFI_NETWORKS_FILE ]; then
|
||||||
|
wifi_networks_file_header
|
||||||
|
fi
|
||||||
|
|
||||||
# update the wifi networks file
|
# update the wifi networks file
|
||||||
echo '' >> $WIFI_NETWORKS_FILE
|
echo '' >> $WIFI_NETWORKS_FILE
|
||||||
echo "$WIFI_SSID" >> $WIFI_NETWORKS_FILE
|
echo "$WIFI_SSID" >> $WIFI_NETWORKS_FILE
|
||||||
|
|
Loading…
Reference in New Issue