OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | #!/bin/sh |
2 | # |
||
3 | # Copyright (C) 2013 OpenWrt.org |
||
4 | # |
||
5 | |||
6 | SWITCH_NAME_CHANGED= |
||
7 | |||
8 | . /lib/functions.sh |
||
9 | |||
10 | do_change_switch_name() { |
||
11 | local config="$1" |
||
12 | local option=$2 |
||
13 | local oldname=$3 |
||
14 | local newname=$4 |
||
15 | local val |
||
16 | |||
17 | config_get val "$config" $option |
||
18 | [ "$val" != "$oldname" ] && return 0 |
||
19 | |||
20 | uci_set network "$config" $option $newname |
||
21 | SWITCH_NAME_CHANGED=1 |
||
22 | |||
23 | return 0 |
||
24 | } |
||
25 | |||
26 | migrate_switch_name() { |
||
27 | local oldname=$1 |
||
28 | local newname=$2 |
||
29 | |||
30 | config_load network |
||
31 | |||
32 | logger -t migrate-switchX "Updating switch names in network configuration" |
||
33 | |||
34 | config_foreach do_change_switch_name switch name $oldname $newname |
||
35 | config_foreach do_change_switch_name switch_vlan device $oldname $newname |
||
36 | |||
37 | [ "$SWITCH_NAME_CHANGED" = "1" ] && { |
||
38 | logger -t migrate-switchX "Switch names updated, saving network configuration" |
||
39 | uci commit network |
||
40 | } |
||
41 | } |
||
42 | |||
43 | board=$(board_name) |
||
44 | |||
45 | case "$board" in |
||
46 | airrouter|\ |
||
47 | ap121|\ |
||
48 | ap121-mini|\ |
||
49 | ap96|\ |
||
50 | dir-600-a1|\ |
||
51 | dir-615-c1|\ |
||
52 | dir-615-e1|\ |
||
53 | dir-615-e4|\ |
||
54 | dir-825-c1|\ |
||
55 | ebr-2310-c1|\ |
||
56 | ew-dorin|\ |
||
57 | ew-dorin-router|\ |
||
58 | ja76pf|\ |
||
59 | rb-750|\ |
||
60 | rb-751|\ |
||
61 | tew-632brp|\ |
||
62 | tew-712br|\ |
||
63 | tl-mr3220|\ |
||
64 | tl-mr3220-v2 |\ |
||
65 | tl-mr3420|\ |
||
66 | tl-wdr4300|\ |
||
67 | tl-wr741nd|\ |
||
68 | tl-wr741nd-v4|\ |
||
69 | tl-wr841n-v7|\ |
||
70 | tl-wr1041n-v2|\ |
||
71 | whr-g301n|\ |
||
72 | whr-hp-g300n|\ |
||
73 | whr-hp-gn|\ |
||
74 | wrt160nl|\ |
||
75 | wzr-hp-ag300h|\ |
||
76 | wzr-hp-g300nh2|\ |
||
77 | wzr-hp-g450h|\ |
||
78 | z1) |
||
79 | migrate_switch_name "eth0" "switch0" |
||
80 | ;; |
||
81 | |||
82 | el-m150|\ |
||
83 | rb-450) |
||
84 | migrate_switch_name "eth1" "switch0" |
||
85 | ;; |
||
86 | |||
87 | db120|\ |
||
88 | rb-2011il|\ |
||
89 | rb-2011ils|\ |
||
90 | rb-2011l|\ |
||
91 | rb-2011uas-2hnd) |
||
92 | migrate_switch_name "eth0" "switch0" |
||
93 | migrate_switch_name "eth1" "switch1" |
||
94 | ;; |
||
95 | |||
96 | dir-825-b1|\ |
||
97 | nbg460n_550n_550nh|\ |
||
98 | tew-673gru) |
||
99 | migrate_switch_name "rtl8366s" "switch0" |
||
100 | ;; |
||
101 | |||
102 | tl-wr1043nd) |
||
103 | migrate_switch_name "rtl8366rb" "switch0" |
||
104 | ;; |
||
105 | |||
106 | esac |
||
107 | |||
108 | exit 0 |