03_network_migration 798 B

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