add copyright headers to base-files scripts and config files
[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 'mtd0: 00060000' /proc/mtd 2>&- >&-; then
10 # WGT634u
11 echo boardtype=wgt634u
12 else
13 strings /dev/mtdblock/3
14 fi
15 ) | awk '
16 function p(name) {
17 if (c[name] != "") print name "=\"" c[name] "\""
18 }
19
20 BEGIN {
21 FS="="
22 c["lan_ifname"]="br0"
23 c["lan_ifnames"]="vlan0 eth1"
24 c["wan_proto"]="none"
25 c["wan_ifname"]="vlan1"
26 c["vlan0ports"]="1 2 3 4 5*"
27 c["vlan1ports"]="0 5"
28 }
29
30 ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") {
31 nvram[$1] = $2
32 }
33
34 END {
35 # v1 hardware
36 if (nvram["boardtype"] == "bcm94710dev") {
37 # Linksys WRT54G v1.x
38 if (nvram["boardnum"] == "42") {
39 c["vlan0ports"]=""
40 c["vlan1ports"]=""
41 c["lan_ifnames"]="vlan2 eth2"
42 }
43
44 # Asus WL-500g
45 if (nvram["boardnum"] == "asusX") {
46 c["lan_ifnames"]="eth0 eth1 eth2" # FIXME
47 # wan_ifname=eth1
48 }
49 }
50 if (nvram["boardtype"] == "wgt634u") {
51 c["vlan0ports"] = "0 1 2 3 5*"
52 c["vlan1ports"] = "4 5"
53 c["lan_ifnames"] = "vlan0 ath0"
54 }
55 if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) {
56 c["vlan0ports"] = "0 1 2 3 5*"
57 c["vlan1ports"] = "4 5"
58 }
59
60 # WAP54G
61 if ((nvram["boardnum"] == "2") || \
62 (nvram["boardnum"] == "1024")) {
63 c["lan_ifnames"]="eth0 eth1"
64 c["wan_ifname"]=""
65 }
66
67 print "#### VLAN configuration "
68 print "vlan0hwname=et0"
69 print "vlan1hwname=et0"
70 p("vlan0ports")
71 p("vlan1ports")
72 print ""
73 print ""
74
75 print "#### LAN configuration"
76 print "lan_proto=\"static\""
77 p("lan_ifname")
78 p("lan_ifnames")
79 print "lan_ipaddr=\"192.168.1.1\""
80 print "lan_netmask=\"255.255.255.0\""
81 print "# lan_dns=\"192.168.1.1\""
82 print "# lan_gateway=\"192.168.1.1\""
83
84 print ""
85 print ""
86
87 print "#### WAN configuration"
88 print "# wan_proto: WAN protocol, available protocols:"
89 print "# none: disable"
90 print "# dhcp: DHCP"
91 print "# static: Static IP"
92 print "# pppoe: PPP over Ethernet"
93 print "# pptp: Point-to-Point tunneling Protocol"
94 print "# for pppoe and pptp you need to use wan_ifname=\"ppp0\""
95 print ""
96 print "wan_proto=dhcp"
97 p("wan_ifname")
98 print "wan_device=\"" c["wan_ifname"] "\""
99 print "# wan_ipaddr=\"192.168.0.2\""
100 print "# wan_netmask=\"255.255.255.0\""
101 print "# wan_gateway=\"192.168.0.1\""
102 print "# wan_dns=\"192.168.0.1\""
103 print ""
104 print "## PPP over Ethernet and PPTP"
105 print "# wan_ifname=\"ppp0\""
106 print "# ppp_username=\"my_username\""
107 print "# ppp_passwd=\"my_password\""
108 print "# pptp_server_ip=\"192.168.0.1\""
109 }
110 ' > /etc/config/network
This page took 0.060734 seconds and 5 git commands to generate.