mirror of
https://github.com/brain-hackers/brain-config.git
synced 2025-12-16 19:14:15 +09:00
Use wpa_cli to check WiFi country setting
This commit is contained in:
20
raspi-config
20
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() {
|
||||
|
||||
Reference in New Issue
Block a user