wifi interface down before scan

This commit is contained in:
Bob Mottram 2016-10-21 18:02:56 +01:00
parent 5c182edb23
commit 5a37cf14be
2 changed files with 8 additions and 15 deletions

View File

@ -71,8 +71,7 @@ function setup_wifi_atheros {
update_wifi_adaptors
if [ $IFACE ]; then
wpa_cli -i ${IFACE} terminate
ifdown --force $IFACE
ifup $IFACE
ifconfig $IFACE up
fi
}
@ -208,9 +207,8 @@ function hotspot_off {
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
fi
systemctl restart network-manager
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
systemctl restart network-manager
}
function hotspot_on {
@ -277,7 +275,7 @@ function hotspot_on {
echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces
systemctl restart network-manager
ifup $WIFI_INTERFACE
ifconfig $WIFI_INTERFACE up
systemctl restart hostapd
}
@ -305,7 +303,7 @@ function wifi_wpa2_psk {
wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
systemctl restart network-manager
ifup ${WIFI_INTERFACE}
ifconfig ${WIFI_INTERFACE} up
}
function wifi_none {
@ -334,7 +332,7 @@ function wifi_none {
echo '}' >> $WIFI_CONFIG
systemctl restart network-manager
ifup ${WIFI_INTERFACE}
ifconfig ${WIFI_INTERFACE} up
}
function networks_from_file {
@ -402,7 +400,7 @@ function networks_from_file {
chattr -i /etc/resolv.conf
systemctl restart network-manager
ifup ${WIFI_INTERFACE}
ifconfig ${WIFI_INTERFACE} up
}
function create_networks_interactive {
@ -497,7 +495,6 @@ function disable_wifi {
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
systemctl restart network-manager
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
else
networks_from_file
fi

View File

@ -85,9 +85,6 @@ do
WIFI_INTERFACE=${1}
wifi_interface_specified=1
write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
ifup ${WIFI_INTERFACE}
;;
-t|--type)
shift
@ -136,6 +133,7 @@ if [ ${NETWORKS_INTERACTIVE} ]; then
fi
if [ ! ${wifi_interface_specified} ]; then
wpa_cli -i ${WIFI_INTERFACE} terminate
update_wifi_adaptors
if [ ! $IFACE ]; then
echo $'No wifi adaptors were found'
@ -144,9 +142,7 @@ if [ ! ${wifi_interface_specified} ]; then
WIFI_INTERFACE=${IFACE}
echo "Adaptor: $WIFI_INTERFACE"
write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
ifup ${WIFI_INTERFACE}
ifconfig ${WIFI_INTERFACE} up
fi
if [ ${WIFI_DISABLE} ]; then