its-ap-builder/access-points/files/tl-wr841-v10/etc/hotplug.d/iface/10-disable-wifi-when-uplink-gone

20 lines
518 B
Bash

#!/bin/sh
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"
uci set wireless.@wifi-device[0].disabled=0
wifi
}
[ "$ACTION" = ifdown ] && {
logger -t wifi-uplink down "$DEVICE" "$INTERFACE" "$ACTION"
wifi down
uci set wireless.@wifi-device[0].disabled=1
}