1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

move country_code - replace '' with $()

This commit is contained in:
Jerry Vonau 2022-05-19 13:01:02 -05:00
parent 743d8f2601
commit a8ca92a9b3

View file

@ -1,4 +1,14 @@
if [ "$interface" = "br0" ] && [ $if_up = "true" ]; then
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}')
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
syslog info "50-iiab IF_UP br0 restarting dnsmasq - kicking ap0"
ip link set ap0 up
systemctl --no-block restart dnsmasq
@ -10,10 +20,8 @@ if [ "$interface" = "wlan0" ]; then
syslog info "50-iiab CARRIER change wlan0"
# wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever
# FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9`
FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2`
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"
@ -25,7 +33,7 @@ if [ "$interface" = "wlan0" ]; then
done
echo "Using $FREQ2 for carrier"
syslog info "50-iiab set channel $FREQ2"
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
HOSTAPD=$(grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}')
echo "Hostapd set for $HOSTAPD"
if [ $FREQ2 -ne $HOSTAPD ] && [ ! -z $FREQ2 ]; then
echo "Editing Hostapd for channel $FREQ2"
@ -35,15 +43,6 @@ 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"