iopsys-feed/inteno-netmodes/files/sbin/netmode-repeater-correction
Alex Oprea 0ad3a95b30 netmode: script to simulate power-off hotplug net events
(of course): The event that happened when the router was powered off
	is simulated by this script.
	Triggered by /etc/init.d/done from base-files.
2017-05-19 14:46:24 +02:00

19 lines
505 B
Bash
Executable file

#!/bin/sh
MTK=0
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
if [ $MTK -eq 1 ]; then
WANDEV="eth0.2"
link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
else
WANDEV="$(uci get layer2_interface_ethernet.Wan.ifname)"
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
fi
[ "$link" == "up" ] && action=add
[ "$link" == "down" ] && action=remove
[ -z "$action" ] && exit
# trigger a fake hotplug net event
INTERFACE=$WANDEV ACTION=$action /sbin/hotplug-call net