8c04fdbf2856f42f9d93e509863233ce1736d1b1
[openwrt/staging/stintel.git] / target / linux / kirkwood / base-files / etc / uci-defaults / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2012 OpenWrt.org
4 #
5
6 [ -e /etc/config/network ] && exit 0
7
8 set_lan_dhcp() {
9 local ifname=$1
10 uci batch <<EOF
11 set network.lan='interface'
12 set network.lan.ifname='$ifname'
13 set network.lan.proto='dhcp'
14 set network.lan6='interface'
15 set network.lan6.ifname='@lan'
16 set network.lan6.proto='dhcpv6'
17 set network.lan6.reqprefix='no'
18 EOF
19 }
20
21 . /lib/functions/uci-defaults.sh
22 . /lib/kirkwood.sh
23
24 touch /etc/config/network
25
26 ucidef_set_interface_loopback
27
28 hardware=$(kirkwood_hardware_name)
29
30 case "$hardware" in
31 "Seagate FreeAgent DockStar")
32 set_lan_dhcp "eth0"
33 ;;
34
35 "RaidSonic ICY BOX IB-NAS6210")
36 set_lan_dhcp "eth0"
37 ;;
38
39 *)
40 ucidef_set_interface_lan "eth0"
41 ;;
42 esac
43
44 uci commit network
45
46 exit 0