kirkwood, ipq806x: fix board.d script permissions
[openwrt/openwrt.git] / target / linux / kirkwood / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2012-2015 OpenWrt.org
4 #
5
6 [ -e /etc/config/network ] && exit 0
7
8 touch /etc/config/network
9
10 set_lan_dhcp() {
11 local ifname=$1
12 uci batch <<EOF
13 set network.lan='interface'
14 set network.lan.ifname='$ifname'
15 set network.lan.proto='dhcp'
16 set network.lan6='interface'
17 set network.lan6.ifname='@lan'
18 set network.lan6.proto='dhcpv6'
19 set network.lan6.reqprefix='no'
20 EOF
21 }
22
23 . /lib/functions/uci-defaults-new.sh
24 . /lib/kirkwood.sh
25
26 board_config_update
27
28 ucidef_set_interface_loopback
29
30 board=$(kirkwood_board_name)
31
32 case "$board" in
33 "dockstar"|\
34 "goflexhome"|\
35 "goflexnet"|\
36 "iconnect"|\
37 "ib62x0"|\
38 "nsa310s"|\
39 "pogo_e02")
40 ucidef_set_interface_lan "eth0" "dhcp"
41 ;;
42 "linksys-audi")
43 ucidef_add_switch "switch0" \
44 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1"
45 ;;
46 "linksys-viper")
47 ucidef_add_switch "switch0" \
48 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1"
49 ;;
50 "guruplug-server-plus")
51 ucidef_set_interface_lan "eth0 eth1" "dhcp"
52 ;;
53 "sheevaplug" | \
54 "sheevaplug-esata")
55 ucidef_set_interface_lan "eth0" "dhcp"
56 ;;
57 *)
58 ucidef_set_interface_lan "eth0" "static"
59 ;;
60 esac
61
62 uci commit network
63
64 exit 0