lantiq: xway: rename nas0/ptm0 to dsl0
[openwrt/openwrt.git] / target / linux / lantiq / base-files / etc / uci-defaults / 02_migrate_xdsl_iface
1 #!/bin/sh
2
3 . /lib/functions.sh
4 . /lib/functions/lantiq.sh
5
6 IFNAME_CHANGED=0
7
8 rename_xdsl_ifname()
9 {
10 local cfg="$1"
11 local section="$2"
12 local option="$3"
13 local name
14
15 config_get name ${section} $option
16 case $name in
17 nas0*)
18 name=${name/nas0/dsl0}
19 ;;
20 ptm0*)
21 name=${name/ptm0/dsl0}
22 ;;
23 *)
24 return
25 ;;
26 esac
27
28 uci set ${cfg}.${section}.$option=$name
29 IFNAME_CHANGED=1
30 }
31
32 migrate_network_xdsl_ifname()
33 {
34 rename_xdsl_ifname network "$1" ifname
35 rename_xdsl_ifname network "$1" name
36 }
37
38 migrate_led_xdsl_ifname()
39 {
40 rename_xdsl_ifname system "$1" dev
41 }
42
43 config_load network
44 config_foreach migrate_network_xdsl_ifname
45
46 [ "$IFNAME_CHANGED" = "1" ] && uci commit network
47
48 IFNAME_CHANGED=0
49
50 config_load system
51 config_foreach migrate_led_xdsl_ifname led
52
53 [ "$IFNAME_CHANGED" = "1" ] && uci commit system
54
55 exit 0