From 1becd779ed7cbfb8b43ee50ade6f19a5b5174f9d Mon Sep 17 00:00:00 2001 From: spl Date: Wed, 2 Mar 2016 10:16:52 +0000 Subject: [PATCH] Wifi country code setting now creates wpa_supplicant.conf if it doesn't exist. --- raspi-config | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/raspi-config b/raspi-config index 9fea2d4..0f4f103 100755 --- a/raspi-config +++ b/raspi-config @@ -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