fix remaining *_ifnames references
[openwrt.git] / package / base-files / brcm-2.4 / etc / init.d / S05netconfig
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 [ -e /etc/config/network ] && exit 0
5
6 mkdir -p /etc/config
7
8 (
9 if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then
10 # WGT634u
11 echo boardtype=wgt634u
12 else
13 strings /dev/mtdblock/3
14 fi
15 ) | awk '
16 function p(cfgname, name) {
17 if (c[name] != "") print " option " cfgname " \"" c[name] "\""
18 }
19
20 BEGIN {
21 FS="="
22 c["lan_ifname"]="eth0.0 wl0"
23 c["wan_ifname"]="eth0.1"
24 c["vlan0ports"]="1 2 3 4 5*"
25 c["vlan1ports"]="0 5"
26 }
27
28 ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") {
29 nvram[$1] = $2
30 }
31
32 END {
33 # v1 hardware
34 if (nvram["boardtype"] == "bcm94710dev") {
35 # Asus WL-500g
36 if (nvram["boardnum"] == "asusX") {
37 c["lan_ifname"]="eth0 eth1 wl0" # FIXME
38 c["wan_ifname"]=""
39 }
40 }
41 if (nvram["boardtype"] == "wgt634u") {
42 c["vlan0ports"] = "0 1 2 3 5*"
43 c["vlan1ports"] = "4 5"
44 c["lan_ifname"] = "eth0.0 ath0"
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 wl0"
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 "#### LAN configuration"
65 print "config interface lan"
66 print " option type bridge"
67 p("ifname", "lan_ifname")
68 print " option proto static"
69 print " option ipaddr 192.168.1.1"
70 print " option netmask 255.255.255.0"
71 print ""
72 print ""
73 print "#### WAN configuration"
74 print "config interface wan"
75 p("ifname", "wan_ifname")
76 print " option proto dhcp"
77 }
78 ' > /etc/config/network
This page took 0.050761 seconds and 5 git commands to generate.