From 999037b87065eefba311700981e22d3c37ec21ab Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Thu, 2 May 2019 13:38:59 +0100 Subject: [PATCH] Use wpa_cli to check WiFi country setting --- debian/changelog | 6 ++++++ raspi-config | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d3c921c..7657174 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +raspi-config (20190502) buster; urgency=medium + + * Use wpa_cli to check WiFi country setting + + -- Serge Schneider Thu, 02 May 2019 13:22:49 +0100 + raspi-config (20190429) buster; urgency=medium * Update do_wifi_country diff --git a/raspi-config b/raspi-config index 7644e96..9f375b8 100755 --- a/raspi-config +++ b/raspi-config @@ -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() {