From ed2a0f3027d1cd61e0fa201108599fe43342b80b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 20 Apr 2022 07:50:40 -0500 Subject: [PATCH] wip on the fly --- roles/network/templates/hostapd/50-hostapd | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/network/templates/hostapd/50-hostapd b/roles/network/templates/hostapd/50-hostapd index 37a363b72..a59f787ee 100644 --- a/roles/network/templates/hostapd/50-hostapd +++ b/roles/network/templates/hostapd/50-hostapd @@ -12,6 +12,9 @@ if [ "$interface" = "wlan0" ]; then # FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9` FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2` FREQ2="" + WPA=`grep country /etc/wpa_supplicant/wpa_supplicant.conf | awk -F = '{print $2}'` + AP=`grep country_code /etc/hostapd/hostapd.conf | awk -F = '{print $2}'` + for result in $FREQ; do echo "frequency is $result for carrier" if [ $result -lt 13 ]; then @@ -32,6 +35,15 @@ if [ "$interface" = "wlan0" ]; then syslog info "THIS MACHINE SHOULD BE REBOOTED" # systemctl restart hostapd fi + if ! [ "$WPA" = "$AP" ]; then + sed -i -e "s/^country_code.*/country_code=$WPA /" /etc/hostapd/hostapd.conf + echo "50-iiab set country_code $WPA" + syslog info "50-iiab set country_code $WPA" + echo "THIS MACHINE SHOULD BE REBOOTED" + syslog info "THIS MACHINE SHOULD BE REBOOTED" +# systemctl restart hostapd + fi + fi # spams the logging #syslog info "50-iiab set ap0 spam $REASON"