mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
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.
This commit is contained in:
parent
136dcee43f
commit
0ad3a95b30
1 changed files with 19 additions and 0 deletions
19
inteno-netmodes/files/sbin/netmode-repeater-correction
Executable file
19
inteno-netmodes/files/sbin/netmode-repeater-correction
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/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
|
||||
Loading…
Add table
Reference in a new issue