OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh /etc/rc.common |
2 | # Copyright (C) 2006 OpenWrt.org |
||
3 | |||
4 | START=05 |
||
5 | |||
6 | start() { |
||
7 | [ -e /etc/config/network ] && exit 0 |
||
8 | |||
9 | mkdir -p /etc/config |
||
10 | |||
11 | board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo) |
||
12 | |||
13 | case "$board_name" in |
||
14 | "Compex WP54"*) |
||
15 | board="Compex WP54";; |
||
16 | esac |
||
17 | |||
18 | echo "$board" |awk ' |
||
19 | function p(cfgname, name) { |
||
20 | if (c[name] != "") print " option " cfgname " \"" c[name] "\"" |
||
21 | } |
||
22 | |||
23 | BEGIN { |
||
24 | FS="=" |
||
25 | c["lan_ifname"]="eth0" |
||
26 | c["wan_ifname"]="eth1" |
||
27 | c["eth0ports"]="1 2 3 4" |
||
28 | c["eth1ports"]="0" |
||
29 | } |
||
30 | END { |
||
31 | board=$1 |
||
32 | if (board == "Compex WP54") { |
||
33 | c["eth0ports"]="0" |
||
34 | c["eth1ports"]="1" |
||
35 | } |
||
36 | |||
37 | print "#### VLAN configuration " |
||
38 | print "config switch" |
||
39 | p("eth0", "eth0ports") |
||
40 | p("eth1", "eth1ports") |
||
41 | print "" |
||
42 | print "" |
||
43 | print "#### Loopback configuration" |
||
44 | print "config interface loopback" |
||
45 | print " option ifname \"lo\"" |
||
46 | print " option proto static" |
||
47 | print " option ipaddr 127.0.0.1" |
||
48 | print " option netmask 255.0.0.0" |
||
49 | print "" |
||
50 | print "" |
||
51 | print "#### LAN configuration" |
||
52 | print "config interface lan" |
||
53 | print " option type bridge" |
||
54 | p("ifname", "lan_ifname") |
||
55 | p("macaddr", "lan_macaddr") |
||
56 | print " option proto static" |
||
57 | print " option ipaddr 192.168.1.1" |
||
58 | print " option netmask 255.255.255.0" |
||
59 | print "" |
||
60 | print "" |
||
61 | print "#### WAN configuration" |
||
62 | print "config interface wan" |
||
63 | p("ifname", "wan_ifname") |
||
64 | p("macaddr", "wan_macaddr") |
||
65 | print " option proto dhcp" |
||
66 | }' > /etc/config/network |
||
67 | } |
||
68 |