Bring up wlan0 when wifi is enabled

This commit is contained in:
Bob Mottram 2016-05-04 15:59:36 +01:00
parent 749536afcd
commit 1f276cb232
No known key found for this signature in database
GPG Key ID: BA68F26108DC9F87
1 changed files with 10 additions and 4 deletions

View File

@ -71,6 +71,7 @@ function hotspot_off {
fi fi
systemctl restart network-manager systemctl restart network-manager
ifdown wlan0
} }
function hotspot_on { function hotspot_on {
@ -137,6 +138,7 @@ function hotspot_on {
echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces
systemctl restart network-manager systemctl restart network-manager
ifup wlan0
systemctl restart hostapd systemctl restart hostapd
} }
@ -166,6 +168,7 @@ function wifi_wpa2_psk {
wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
systemctl restart network-manager systemctl restart network-manager
ifup wlan0
} }
function wifi_none { function wifi_none {
@ -196,6 +199,7 @@ function wifi_none {
echo '}' >> $WIFI_CONFIG echo '}' >> $WIFI_CONFIG
systemctl restart network-manager systemctl restart network-manager
ifup wlan0
} }
function networks_from_file { function networks_from_file {
@ -259,13 +263,14 @@ function networks_from_file {
done < $WIFI_NETWORKS_FILE done < $WIFI_NETWORKS_FILE
systemctl restart network-manager systemctl restart network-manager
ifup wlan0
} }
function create_networks_interactive { function create_networks_interactive {
if [ -f $WIFI_NETWORKS_FILE ]; then if [ -f $WIFI_NETWORKS_FILE ]; then
rm $WIFI_NETWORKS_FILE rm $WIFI_NETWORKS_FILE
fi fi
echo $'# Add wifi networks as follows:' > $WIFI_NETWORKS_FILE echo $'# Add wifi networks as follows:' > $WIFI_NETWORKS_FILE
echo '#' >> $WIFI_NETWORKS_FILE echo '#' >> $WIFI_NETWORKS_FILE
echo $'# MySSID' >> $WIFI_NETWORKS_FILE echo $'# MySSID' >> $WIFI_NETWORKS_FILE
@ -302,12 +307,12 @@ function create_networks_interactive {
if [ ${#WIFI_SSID} -lt 2 ]; then if [ ${#WIFI_SSID} -lt 2 ]; then
wifi_networks_done='yes' wifi_networks_done='yes'
continue continue
fi fi
if [ ${#WIFI_TYPE} -lt 2 ]; then if [ ${#WIFI_TYPE} -lt 2 ]; then
wifi_networks_done='yes' wifi_networks_done='yes'
continue continue
fi 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
@ -331,6 +336,7 @@ function disable_wifi {
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
systemctl restart network-manager systemctl restart network-manager
ifdown wlan0
else else
networks_from_file networks_from_file
fi fi
@ -399,7 +405,7 @@ do
WIFI_DISABLE='yes' WIFI_DISABLE='yes'
else else
WIFI_DISABLE='no' WIFI_DISABLE='no'
fi fi
;; ;;
*) *)
# unknown option # unknown option