2013-02-11 21:41:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
|
|
|
SWITCH_NAME_CHANGED=
|
|
|
|
|
|
|
|
do_change_switch_name() {
|
|
|
|
local config="$1"
|
|
|
|
local option=$2
|
|
|
|
local oldname=$3
|
|
|
|
local newname=$4
|
|
|
|
local val
|
|
|
|
|
|
|
|
config_get val "$config" $option
|
|
|
|
[ "$val" != "$oldname" ] && return 0
|
|
|
|
|
|
|
|
uci_set network "$config" $option $newname
|
|
|
|
SWITCH_NAME_CHANGED=1
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
migrate_switch_name() {
|
|
|
|
local oldname=$1
|
|
|
|
local newname=$2
|
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
|
|
|
|
config_load network
|
|
|
|
|
|
|
|
logger -t migrate-switchX "Updating switch names in network configuration"
|
|
|
|
|
|
|
|
config_foreach do_change_switch_name switch name $oldname $newname
|
|
|
|
config_foreach do_change_switch_name switch_vlan device $oldname $newname
|
|
|
|
|
2014-10-14 12:21:11 +00:00
|
|
|
[ "$SWITCH_NAME_CHANGED" = "1" ] && {
|
2013-02-11 21:41:16 +00:00
|
|
|
logger -t migrate-switchX "Switch names updated, saving network configuration"
|
|
|
|
uci commit network
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
. /lib/ar71xx.sh
|
|
|
|
|
|
|
|
board=$(ar71xx_board_name)
|
|
|
|
|
|
|
|
case "$board" in
|
|
|
|
dir-825-c1|\
|
|
|
|
wzr-hp-g300nh2|\
|
|
|
|
pb92|\
|
|
|
|
ap113|\
|
|
|
|
tl-wdr4300|\
|
|
|
|
tl-wr1041n-v2|\
|
|
|
|
wrt160nl|\
|
|
|
|
ap121|\
|
|
|
|
ap121-mini|\
|
|
|
|
ap96|\
|
|
|
|
airrouter|\
|
|
|
|
dir-600-a1|\
|
|
|
|
dir-615-c1|\
|
2014-06-02 14:43:35 +00:00
|
|
|
dir-615-e1|\
|
2013-02-11 21:41:16 +00:00
|
|
|
dir-615-e4|\
|
|
|
|
ja76pf|\
|
2015-05-23 15:27:22 +00:00
|
|
|
mr-12|\
|
|
|
|
mr-16|\
|
2013-02-11 21:41:16 +00:00
|
|
|
rb-750|\
|
|
|
|
rb-751|\
|
|
|
|
tew-632brp|\
|
|
|
|
tew-712br|\
|
|
|
|
tl-mr3220|\
|
|
|
|
tl-mr3220-v2 |\
|
|
|
|
tl-mr3420|\
|
|
|
|
tl-wr741nd|\
|
|
|
|
tl-wr741nd-v4|\
|
|
|
|
tl-wr841n-v7|\
|
|
|
|
whr-g301n|\
|
|
|
|
whr-hp-g300n|\
|
|
|
|
whr-hp-gn|\
|
|
|
|
wzr-hp-ag300h|\
|
|
|
|
wzr-hp-g450h|\
|
2016-09-20 12:14:29 +00:00
|
|
|
z1|\
|
2013-02-11 21:41:16 +00:00
|
|
|
ew-dorin|\
|
|
|
|
ew-dorin-router)
|
|
|
|
migrate_switch_name "eth0" "switch0"
|
|
|
|
;;
|
|
|
|
|
2014-06-26 11:49:47 +00:00
|
|
|
el-m150|\
|
2013-02-11 21:41:16 +00:00
|
|
|
rb-450)
|
|
|
|
migrate_switch_name "eth1" "switch0"
|
|
|
|
;;
|
|
|
|
|
|
|
|
db120 |\
|
|
|
|
rb-2011l | \
|
|
|
|
rb-2011uas-2hnd)
|
|
|
|
migrate_switch_name "eth0" "switch0"
|
|
|
|
migrate_switch_name "eth1" "switch1"
|
|
|
|
;;
|
|
|
|
|
|
|
|
dir-825-b1|\
|
|
|
|
tew-673gru|\
|
|
|
|
nbg460n_550n_550nh)
|
|
|
|
migrate_switch_name "rtl8366s" "switch0"
|
|
|
|
;;
|
|
|
|
|
|
|
|
tl-wr1043nd)
|
|
|
|
migrate_switch_name "rtl8366rb" "switch0"
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|