its-ap-builder/files/common/its/etc/hotplug.d/iface/10-disable-wifi-when-uplink-gone

29 lines
710 B
Text
Raw Permalink Normal View History

2017-10-04 18:52:03 +02:00
#!/bin/sh
2018-04-13 23:57:13 +02:00
uci_set_forall_wifi_ifaces () {
WIFI_IFACES=$(uci show wireless | sed -nr 's/^wireless\.([^=]+)=wifi-iface*$/\1/p')
for iface in $WIFI_IFACES; do
uci set wireless.$iface."$1"
done
}
2017-10-04 18:52:03 +02:00
logger -t wifi-uplink hotplug "$DEVICE" "$INTERFACE" "$ACTION"
# 'lan' doesn't work for some reason
[ "$INTERFACE" = apctl ] || exit 0
logger -t wifi-uplink devchange "$DEVICE" "$INTERFACE" "$ACTION"
[ "$ACTION" = ifup ] && {
logger -t wifi-uplink up "$DEVICE" "$INTERFACE" "$ACTION"
2018-04-13 23:57:13 +02:00
uci_set_forall_wifi_ifaces disabled=0
2017-10-04 18:52:03 +02:00
wifi
}
[ "$ACTION" = ifdown ] && {
logger -t wifi-uplink down "$DEVICE" "$INTERFACE" "$ACTION"
wifi down
2018-04-13 23:57:13 +02:00
uci_set_forall_wifi_ifaces disabled=1
2017-10-04 18:52:03 +02:00
}