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

Explain & lint templates/hostapd/iiab-test-wifi.j2

This commit is contained in:
root 2023-04-24 17:46:24 +01:00
parent 73e123a357
commit a17103f14f
2 changed files with 30 additions and 4 deletions

View file

@ -1,4 +1,17 @@
#!/bin/sh
# 2023-04-24 PR #3542 / PR #3549 context:
# "systemd-network" "RasPiOS" have files with the client wifi info within them,
# those can be parsed for the ssid without needing the related service running
# first.
# "Netplan systemd" "NetworkManager" need to be running to be able to parse for
# the ssid, from the generated config file for "Netplan systemd" and from the
# running environment for "NetworkManager".
# "iiab-wifi-test.service" acts as a bit of a traffic cop keeping the ordering
# of the services more deterministic when active and tries to catch a channel
# mismatch between client wifi's current setting and what is contained within
# hostapd.conf early in the boot process.
IFACE={{ discovered_wireless_iface }}
NETPLAN=0
SSID=""
@ -87,8 +100,8 @@ if [ -z "$FREQ2" ]; then
fi
# ubuntu on boot exits at this point timing - issue with wpa_cli and scanning
CHAN=$((FREQ2 - 2407 ))
CHAN=$((CHAN / 5 ))
CHAN=$((FREQ2 - 2407))
CHAN=$((CHAN / 5))
echo "channel is $CHAN for $SSID"
HOSTAPD=$(grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}')
echo "Hostapd set for $HOSTAPD"
@ -99,5 +112,3 @@ if [ "$CHAN" -ne "$HOSTAPD" ]; then
/bin/systemctl --no-block restart hostapd
echo "Restarted hostapd"
fi
exit 0