1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00
iiab/roles/network/templates/hostapd/netd-disp2
2023-04-24 12:42:16 -05:00

19 lines
803 B
Bash

#!/bin/bash
if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then
echo "NET-DISP-WiFi $IFACE $STATE"
# If we are here we have a dhcp ip address
CHAN=$(iw "$IFACE" info|grep channel|cut -d' ' -f2)
echo "Using channel $CHAN for carrier"
HOSTAPD=$(grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}')
echo "Hostapd set for $HOSTAPD"
if [ $CHAN -ne $HOSTAPD ] && [ $CHAN -lt 14 ]; then
echo "Editing Hostapd for channel $CHAN"
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
sed -i "s/^channel.*/channel=$CHAN/" /etc/hostapd/hostapd.conf
systemctl restart hostapd
else
echo "Upstream Channel greater than 13 or is the same - not changing hostapd.conf"
fi
sleep 3
/usr/sbin/ip link set ap0 up
fi