mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
45 lines
1.2 KiB
Bash
Executable file
45 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
wan=$(db -q get hw.board.ethernetWanPort)
|
|
|
|
[ -z "$wan" ] && exit 1 # no configuration
|
|
[ "$PORT" != "$wan" ] && exit 0
|
|
|
|
remove_from_bridge() {
|
|
config_get ifname "$section" ifname
|
|
|
|
ubus call network.interface.$bridge remove_device '{"name":"$ifname"}'
|
|
}
|
|
|
|
update_bstas() {
|
|
local section="$1"
|
|
local action="$2"
|
|
local ifname onboarded
|
|
|
|
config_get ifname "$section" ifname
|
|
config_get_bool enabled "$section" enabled 0
|
|
|
|
if [ "$action" = "down" ]; then
|
|
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
|
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
|
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
|
elif [ "$action" = "up" ]; then
|
|
[ "$enabled" -eq 0 ] && return
|
|
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
|
|
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
|
|
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
|
fi
|
|
}
|
|
|
|
if [ "$LINK" = "up" ]; then
|
|
touch /tmp/map.agent.bsta_global_disable
|
|
|
|
config_load "mapagent"
|
|
bridge=$(uci get mapagent.agent.al_bridge | cut -d '-' -f2)
|
|
config_foreach remove_from_bridge bk-iface $bridge
|
|
config_foreach update_bstas bk-iface down
|
|
else
|
|
rm -f /tmp/map.agent.bsta_global_disable
|
|
config_load "mapagent"
|
|
config_foreach update_bstas bk-iface up
|
|
fi
|