1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

dhcpcd hook refinements

This commit is contained in:
Jerry Vonau 2020-05-04 18:14:43 -05:00
parent 7fd6fc9737
commit 25bd5a9b3c

View file

@ -6,9 +6,23 @@ if [ "$interface" = "wlan0" ]; then
# 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`
syslog info "40-iiab set channel $FREQ"
sed -i -e "s/^channel.*/channel=$FREQ /" /etc/hostapd/hostapd.conf
# will need a reboot for hostapd if the channel changed
FREQ2=""
for result in $FREQ; do
echo "frequency is $result for carrier"
if [ $result -lt 13 ]; then
FREQ2=$result
fi
done
echo "Using $FREQ2 for $SSID"
syslog info "50-iiab set channel $FREQ2"
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"
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
sed -i -e "s/^channel.*/channel=$FREQ /" /etc/hostapd/hostapd.conf
# systemctl restart hostapd
fi
fi
# spams the logging
#syslog info "50-iiab set ap0 spam $REASON"