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
update_wifi_adaptors
if [ $IFACE ]; then
wpa_cli -i ${IFACE} terminate
ifdown --force $IFACE
ifup $IFACE
fi
@ -208,7 +209,8 @@ function hotspot_off {
fi
systemctl restart network-manager
ifdown --force $WIFI_INTERFACE
wpa_cli -i ${WIFI_INTERFACE} terminate
ifdown --force ${WIFI_INTERFACE}
}
function hotspot_on {
@ -494,6 +496,7 @@ function disable_wifi {
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
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

View File

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