Wifi country code setting now creates wpa_supplicant.conf if it doesn't exist.

This commit is contained in:
spl 2016-03-02 10:16:52 +00:00 committed by Serge Schneider
parent b03f0ece9f
commit 1becd779ed

View File

@ -283,10 +283,14 @@ do_configure_wifi_country() {
true
fi
if [ $? -eq 0 ];then
if grep -q "^country=" /etc/wpa_supplicant/wpa_supplicant.conf ; then
sed -i "s/^country=.*/country=$COUNTRY/g" /etc/wpa_supplicant/wpa_supplicant.conf
if [ -e /etc/wpa_supplicant/wpa_supplicant.conf ]; then
if grep -q "^country=" /etc/wpa_supplicant/wpa_supplicant.conf ; then
sed -i "s/^country=.*/country=$COUNTRY/g" /etc/wpa_supplicant/wpa_supplicant.conf
else
sed -i "1i country=$COUNTRY" /etc/wpa_supplicant/wpa_supplicant.conf
fi
else
sed -i "1i country=$COUNTRY" /etc/wpa_supplicant/wpa_supplicant.conf
echo "country=$COUNTRY" > /etc/wpa_supplicant/wpa_supplicant.conf
fi
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "Wi-fi country set to $COUNTRY" 20 60 1