forked from openwrt/openwrt
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
02_migrate_xdsl_iface
64 lines (49 loc) · 1021 Bytes
/
02_migrate_xdsl_iface
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
. /lib/functions.sh
IFNAME_CHANGED=0
rename_xdsl_ifname()
{
local cfg="$1"
local section="$2"
local option="$3"
local name
config_get name ${section} $option
case $name in
nas0*)
name=${name/nas0/dsl0}
;;
ptm0*)
name=${name/ptm0/dsl0}
;;
*)
return
;;
esac
uci set ${cfg}.${section}.$option=$name
IFNAME_CHANGED=1
}
add_atm_bridge_nameprefix()
{
local cfg="$1"
config_get nameprefix "$cfg" nameprefix
[ -z "$nameprefix" ] || return
uci set network.${cfg}.nameprefix="dsl"
IFNAME_CHANGED=1
}
migrate_network_xdsl_ifname()
{
rename_xdsl_ifname network "$1" ifname
rename_xdsl_ifname network "$1" name
}
migrate_led_xdsl_ifname()
{
rename_xdsl_ifname system "$1" dev
}
config_load network
config_foreach migrate_network_xdsl_ifname
config_foreach add_atm_bridge_nameprefix atm-bridge
[ "$IFNAME_CHANGED" = "1" ] && uci commit network
IFNAME_CHANGED=0
config_load system
config_foreach migrate_led_xdsl_ifname led
[ "$IFNAME_CHANGED" = "1" ] && uci commit system
exit 0