Use wpa_cli to check WiFi country setting

This commit is contained in:
Serge Schneider 2019-05-02 13:38:59 +01:00
parent 15d2601316
commit 999037b870
2 changed files with 25 additions and 1 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
raspi-config (20190502) buster; urgency=medium
* Use wpa_cli to check WiFi country setting
-- Serge Schneider <serge@raspberrypi.org> Thu, 02 May 2019 13:22:49 +0100
raspi-config (20190429) buster; urgency=medium
* Update do_wifi_country

View File

@ -429,7 +429,25 @@ do_change_timezone() {
}
get_wifi_country() {
grep country= /etc/wpa_supplicant/wpa_supplicant.conf | cut -d "=" -f 2
IFACE="$(list_wlan_interfaces | head -n 1)"
if [ -z "$IFACE" ]; then
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "No wireless interface found" 20 60
fi
return 1
fi
if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60
fi
return 1
fi
wpa_cli -i "$IFACE" reconfigure > /dev/null 2>&1
COUNTRY="$(wpa_cli -i "$IFACE" get country)"
if [ "$COUNTRY" = "FAIL" ]; then
return 1
fi
echo "$COUNTRY"
}
do_wifi_country() {