Procházet zdrojové kódy

Terminale wpa_supplicant before restart of wifi

Bob Mottram před 8 roky
rodič
revize
5c182edb23
2 změnil soubory, kde provedl 19 přidání a 14 odebrání
  1. 4
    1
      src/freedombone-utils-wifi
  2. 15
    13
      src/freedombone-wifi

+ 4
- 1
src/freedombone-utils-wifi Zobrazit soubor

@@ -70,6 +70,7 @@ function setup_wifi_atheros {
70 70
     cd $curr_dir
71 71
     update_wifi_adaptors
72 72
     if [ $IFACE ]; then
73
+        wpa_cli -i ${IFACE} terminate
73 74
         ifdown --force $IFACE
74 75
         ifup $IFACE
75 76
     fi
@@ -208,7 +209,8 @@ function hotspot_off {
208 209
     fi
209 210
 
210 211
     systemctl restart network-manager
211
-    ifdown --force $WIFI_INTERFACE
212
+    wpa_cli -i ${WIFI_INTERFACE} terminate
213
+    ifdown --force ${WIFI_INTERFACE}
212 214
 }
213 215
 
214 216
 function hotspot_on {
@@ -494,6 +496,7 @@ function disable_wifi {
494 496
         echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
495 497
         echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
496 498
         systemctl restart network-manager
499
+        wpa_cli -i ${WIFI_INTERFACE} terminate
497 500
         ifdown --force ${WIFI_INTERFACE}
498 501
     else
499 502
         networks_from_file

+ 15
- 13
src/freedombone-wifi Zobrazit soubor

@@ -85,8 +85,9 @@ do
85 85
             WIFI_INTERFACE=${1}
86 86
             wifi_interface_specified=1
87 87
             write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
88
-            ifdown --force $WIFI_INTERFACE
89
-            ifup $WIFI_INTERFACE
88
+            wpa_cli -i ${WIFI_INTERFACE} terminate
89
+            ifdown --force ${WIFI_INTERFACE}
90
+            ifup ${WIFI_INTERFACE}
90 91
             ;;
91 92
         -t|--type)
92 93
             shift
@@ -129,41 +130,42 @@ do
129 130
     shift
130 131
 done
131 132
 
132
-if [ $NETWORKS_INTERACTIVE ]; then
133
+if [ ${NETWORKS_INTERACTIVE} ]; then
133 134
     create_networks_interactive
134 135
     exit 0
135 136
 fi
136 137
 
137
-if [ ! $wifi_interface_specified ]; then
138
+if [ ! ${wifi_interface_specified} ]; then
138 139
     update_wifi_adaptors
139 140
     if [ ! $IFACE ]; then
140 141
         echo $'No wifi adaptors were found'
141 142
         exit 872356
142 143
     fi
143
-    WIFI_INTERFACE=$IFACE
144
+    WIFI_INTERFACE=${IFACE}
144 145
     echo "Adaptor: $WIFI_INTERFACE"
145 146
     write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
146
-    ifdown --force $WIFI_INTERFACE
147
-    ifup $WIFI_INTERFACE
147
+    wpa_cli -i ${WIFI_INTERFACE} terminate
148
+    ifdown --force ${WIFI_INTERFACE}
149
+    ifup ${WIFI_INTERFACE}
148 150
 fi
149 151
 
150
-if [ $WIFI_DISABLE ]; then
151
-    disable_wifi $WIFI_DISABLE
152
+if [ ${WIFI_DISABLE} ]; then
153
+    disable_wifi ${WIFI_DISABLE}
152 154
     remove_config_param "WIFI_INTERFACE"
153 155
     exit 0
154 156
 fi
155 157
 
156
-if [ -f $WIFI_NETWORKS_FILE ]; then
158
+if [ -f ${WIFI_NETWORKS_FILE} ]; then
157 159
     networks_from_file
158 160
     exit 0
159 161
 fi
160 162
 
161
-if [ ! $WIFI_SSID ]; then
163
+if [ ! ${WIFI_SSID} ]; then
162 164
     echo $'No SSID given'
163 165
     exit 1
164 166
 fi
165 167
 
166
-if [[ $WIFI_HOTSPOT != 'no' ]]; then
168
+if [[ ${WIFI_HOTSPOT} != 'no' ]]; then
167 169
     hotspot_on
168 170
     exit 0
169 171
 else
@@ -177,7 +179,7 @@ if [[ "$WIFI_TYPE" != 'none' && "$WIFI_TYPE" != 'open' ]]; then
177 179
     fi
178 180
 fi
179 181
 
180
-if [[ $WIFI_TYPE == 'wpa2-psk' ]]; then
182
+if [[ ${WIFI_TYPE} == 'wpa2-psk' ]]; then
181 183
     if [ ! -d /etc/wpa_supplicant ]; then
182 184
         echo $'wpasupplicant package is not installed'
183 185
         exit 3