Terminale wpa_supplicant before restart of wifi

This commit is contained in:
Bob Mottram 2016-10-21 17:40:06 +01:00
parent 4db154ff80
commit 5c182edb23
2 changed files with 19 additions and 14 deletions

View File

@ -70,6 +70,7 @@ function setup_wifi_atheros {
cd $curr_dir cd $curr_dir
update_wifi_adaptors update_wifi_adaptors
if [ $IFACE ]; then if [ $IFACE ]; then
wpa_cli -i ${IFACE} terminate
ifdown --force $IFACE ifdown --force $IFACE
ifup $IFACE ifup $IFACE
fi fi
@ -208,7 +209,8 @@ function hotspot_off {
fi fi
systemctl restart network-manager systemctl restart network-manager
ifdown --force $WIFI_INTERFACE wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
} }
function hotspot_on { function hotspot_on {
@ -494,6 +496,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
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE} ifdown --force ${WIFI_INTERFACE}
else else
networks_from_file networks_from_file

View File

@ -85,8 +85,9 @@ do
WIFI_INTERFACE=${1} WIFI_INTERFACE=${1}
wifi_interface_specified=1 wifi_interface_specified=1
write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE" write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
ifdown --force $WIFI_INTERFACE wpa_cli -i ${WIFI_INTERFACE} terminate
ifup $WIFI_INTERFACE ifdown --force ${WIFI_INTERFACE}
ifup ${WIFI_INTERFACE}
;; ;;
-t|--type) -t|--type)
shift shift
@ -129,41 +130,42 @@ do
shift shift
done done
if [ $NETWORKS_INTERACTIVE ]; then if [ ${NETWORKS_INTERACTIVE} ]; then
create_networks_interactive create_networks_interactive
exit 0 exit 0
fi fi
if [ ! $wifi_interface_specified ]; then if [ ! ${wifi_interface_specified} ]; then
update_wifi_adaptors update_wifi_adaptors
if [ ! $IFACE ]; then if [ ! $IFACE ]; then
echo $'No wifi adaptors were found' echo $'No wifi adaptors were found'
exit 872356 exit 872356
fi fi
WIFI_INTERFACE=$IFACE WIFI_INTERFACE=${IFACE}
echo "Adaptor: $WIFI_INTERFACE" echo "Adaptor: $WIFI_INTERFACE"
write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE" write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
ifdown --force $WIFI_INTERFACE wpa_cli -i ${WIFI_INTERFACE} terminate
ifup $WIFI_INTERFACE ifdown --force ${WIFI_INTERFACE}
ifup ${WIFI_INTERFACE}
fi fi
if [ $WIFI_DISABLE ]; then if [ ${WIFI_DISABLE} ]; then
disable_wifi $WIFI_DISABLE disable_wifi ${WIFI_DISABLE}
remove_config_param "WIFI_INTERFACE" remove_config_param "WIFI_INTERFACE"
exit 0 exit 0
fi fi
if [ -f $WIFI_NETWORKS_FILE ]; then if [ -f ${WIFI_NETWORKS_FILE} ]; then
networks_from_file networks_from_file
exit 0 exit 0
fi fi
if [ ! $WIFI_SSID ]; then if [ ! ${WIFI_SSID} ]; then
echo $'No SSID given' echo $'No SSID given'
exit 1 exit 1
fi fi
if [[ $WIFI_HOTSPOT != 'no' ]]; then if [[ ${WIFI_HOTSPOT} != 'no' ]]; then
hotspot_on hotspot_on
exit 0 exit 0
else else
@ -177,7 +179,7 @@ if [[ "$WIFI_TYPE" != 'none' && "$WIFI_TYPE" != 'open' ]]; then
fi fi
fi fi
if [[ $WIFI_TYPE == 'wpa2-psk' ]]; then if [[ ${WIFI_TYPE} == 'wpa2-psk' ]]; then
if [ ! -d /etc/wpa_supplicant ]; then if [ ! -d /etc/wpa_supplicant ]; then
echo $'wpasupplicant package is not installed' echo $'wpasupplicant package is not installed'
exit 3 exit 3