mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
ap0 - introduce wifi-test.service
This commit is contained in:
parent
8669a97d18
commit
e125537c0c
2 changed files with 40 additions and 0 deletions
23
roles/network/templates/hostapd/test-wifi
Executable file
23
roles/network/templates/hostapd/test-wifi
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
IFACE={{ discovered_wireless_iface }}
|
||||||
|
SSID=""
|
||||||
|
if [ -f /run/netplan/wpa-$IFACE.conf ]; then
|
||||||
|
SSID=`grep ssid /run/netplan/wpa-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\">
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then
|
||||||
|
SSID=`grep ssid /etc/wpa_supplicant/wpa_supplicant.conf | awk -F = '{print $2}' | sed -r s/\"// | >
|
||||||
|
fi
|
||||||
|
if [ -f /etc/iiab/iiab.env ]; then
|
||||||
|
source /etc/iiab/iiab.env
|
||||||
|
if [ ! -z $CLIENT_SSID ]; then
|
||||||
|
SSID=$CLIENT_SSID
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
wpa_cli -i wlan0 scan > /dev/null
|
||||||
|
sleep 2
|
||||||
|
FREQ=`wpa_cli -i wlan0 scan_results | grep $SSID | awk '{print $2}'`
|
||||||
|
echo "frequency is $FREQ for $SSID"
|
||||||
|
CHAN=$(((($FREQ - 2407)) / 5 ))
|
||||||
|
echo "channel is $CHAN for $SSID"
|
||||||
|
|
17
roles/network/templates/hostapd/wifi-test.service.j2
Normal file
17
roles/network/templates/hostapd/wifi-test.service.j2
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[Unit]
|
||||||
|
Description=IIAB find channel freq for ssid
|
||||||
|
After=wpa_supplicant.service
|
||||||
|
Wants=wpa_supplicant.service
|
||||||
|
Requires=wpa_supplicant.service
|
||||||
|
Before=hostapd.service
|
||||||
|
Before=dhcpcd.service
|
||||||
|
Before=network-manager.service
|
||||||
|
Before=netplan-wpa-{{ discovered_wireless_iface }}.service
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/sbin/test-wifi
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue