1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +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

15
adm-run-roles-tmp.yml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: all
become: yes
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_local.local_facts.os_ver }}.yml
- /etc/iiab/local_vars.yml
- /etc/iiab/iiab_state.yml
roles:
- { role: 0-init }
- { role: captiveportal }
- { role: lokole }
- { role: network }

View file

@ -1,4 +1,17 @@
#!/bin/sh #!/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 }} IFACE={{ discovered_wireless_iface }}
NETPLAN=0 NETPLAN=0
SSID="" SSID=""
@ -87,8 +100,8 @@ if [ -z "$FREQ2" ]; then
fi fi
# ubuntu on boot exits at this point timing - issue with wpa_cli and scanning # ubuntu on boot exits at this point timing - issue with wpa_cli and scanning
CHAN=$((FREQ2 - 2407 )) CHAN=$((FREQ2 - 2407))
CHAN=$((CHAN / 5 )) CHAN=$((CHAN / 5))
echo "channel is $CHAN for $SSID" echo "channel is $CHAN for $SSID"
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" echo "Hostapd set for $HOSTAPD"
@ -99,5 +112,3 @@ if [ "$CHAN" -ne "$HOSTAPD" ]; then
/bin/systemctl --no-block restart hostapd /bin/systemctl --no-block restart hostapd
echo "Restarted hostapd" echo "Restarted hostapd"
fi fi
exit 0