912fe96224737a836df33fa84938a9bd858b860d
[openwrt/openwrt.git] / target / linux / brcm47xx / base-files / etc / uci-defaults / 03_network_migration
1 #!/bin/sh
2 #
3 # Copyright (C) 2014-2015 OpenWrt.org
4 #
5
6 uci show network | grep "\.vlan=0"
7 [ $? -ne 0 ] && exit 0
8
9 logger -t network "network config is invalid, creating new one"
10
11 local lan_proto="$(uci -q get network.lan.proto)"
12 local lan_ipaddr="$(uci -q get network.lan.ipaddr)"
13 local lan_netmask="$(uci -q get network.lan.netmask)"
14 local wan_proto="$(uci -q get network.wan.proto)"
15 local wan_ipaddr="$(uci -q get network.wan.ipaddr)"
16 local wan_netmask="$(uci -q get network.wan.netmask)"
17
18 echo "" > /etc/config/network
19 config_generate
20
21 uci set network.lan.proto=$lan_proto
22 uci set network.lan.ipaddr=$lan_ipaddr
23 uci set network.lan.netmask=$lan_netmask
24 uci set network.wan.proto=$wan_proto
25 uci set network.wan.ipaddr=$wan_ipaddr
26 uci set network.wan.netmask=$wan_netmask
27 uci commit network
28
29 exit 0