disable entropy gathering in wlcompat-debug
[openwrt.git] / package / base-files / brcm-2.4 / etc / init.d / S05netconfig
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 start() {
5         [ -e /etc/config/network ] && exit 0
6
7         mkdir -p /etc/config
8
9         (
10                 if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then
11                         # WGT634u
12                         echo boardtype=wgt634u
13                 else
14                         strings /dev/mtdblock/3
15                 fi
16         ) | awk '
17         function p(cfgname, name) {
18                 if (c[name] != "") print "      option " cfgname "      \"" c[name] "\""
19         }
20         
21         BEGIN {
22                 FS="="
23                 c["lan_ifname"]="eth0.0"
24                 c["wan_ifname"]="eth0.1"
25                 c["vlan0ports"]="1 2 3 4 5*"
26                 c["vlan1ports"]="0 5"
27         }
28         
29         ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") {
30                 nvram[$1] = $2
31         }
32         
33         END {
34                 # v1 hardware
35                 if (nvram["boardtype"] == "bcm94710dev") {
36                         # Asus WL-500g
37                         if (nvram["boardnum"] == "asusX") {
38                                 c["lan_ifname"]="eth0 eth1" # FIXME
39                                 c["wan_ifname"]=""
40                         }
41                 }
42                 if (nvram["boardtype"] == "wgt634u") {
43                         c["vlan0ports"] = "0 1 2 3 5*"
44                         c["vlan1ports"] = "4 5"
45                 }
46                 if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) {
47                         c["vlan0ports"] = "0 1 2 3 5*"
48                         c["vlan1ports"] = "4 5"
49                 }
50         
51                 # WAP54G
52                 if ((nvram["boardnum"] == "2") || \
53                         (nvram["boardnum"] == "1024")) {
54                         c["lan_ifname"]="eth0"
55                         c["wan_ifname"]=""
56                 }
57         
58                 print "#### VLAN configuration "
59                 print "config switch eth0"
60                 p("vlan0", "vlan0ports")
61                 p("vlan1", "vlan1ports")
62                 print ""
63                 print ""
64                 print "#### Loopback configuration"
65                 print "config interface loopback"
66                 print " option ifname   \"lo\""
67                 print " option proto    static"
68                 print " option ipaddr   127.0.0.1"
69                 print " option netmask  255.0.0.0"
70                 print ""
71                 print ""
72                 print "#### LAN configuration"
73                 print "config interface lan"
74                 print " option type     bridge"
75                 p("ifname", "lan_ifname")
76                 print " option proto    static"
77                 print " option ipaddr   192.168.1.1"
78                 print " option netmask  255.255.255.0"
79                 print ""
80                 print ""
81                 print "#### WAN configuration"
82                 print "config interface wan"
83                 p("ifname", "wan_ifname")
84                 print " option proto    dhcp"
85         }' > /etc/config/network
86 }