2008-02-27 15:59:15 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
|
|
|
START=05
|
|
|
|
|
|
|
|
start() {
|
|
|
|
[ -e /etc/config/network ] && exit 0
|
|
|
|
|
|
|
|
mkdir -p /etc/config
|
|
|
|
|
|
|
|
board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
|
|
|
|
|
|
|
|
case "$board_name" in
|
|
|
|
"Compex WP54"*)
|
2008-03-18 03:16:32 +00:00
|
|
|
board="Compex WP54";;
|
2008-02-27 15:59:15 +00:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-03-18 03:16:32 +00:00
|
|
|
echo "$board" |awk '
|
|
|
|
board=$1
|
|
|
|
|
|
|
|
function p(cfgname, name) {
|
|
|
|
if (c[name] != "") print " option " cfgname " \"" c[name] "\""
|
|
|
|
}
|
|
|
|
|
2008-02-27 15:59:15 +00:00
|
|
|
BEGIN {
|
|
|
|
FS="="
|
|
|
|
c["lan_ifname"]="eth0"
|
|
|
|
c["wan_ifname"]="eth1"
|
2008-03-18 03:16:32 +00:00
|
|
|
c["eth0ports"]="1 2 3 4 5"
|
2008-02-27 15:59:15 +00:00
|
|
|
c["eth1ports"]="0"
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
2008-03-18 03:16:32 +00:00
|
|
|
if (board == "Compex WP54") {
|
|
|
|
c["eth0ports"]="0"
|
|
|
|
c["eth1ports"]="1"
|
2008-02-27 15:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print "#### VLAN configuration "
|
|
|
|
print "config switch"
|
|
|
|
p("eth0", "eth0ports")
|
|
|
|
p("eth1", "eth1ports")
|
|
|
|
print ""
|
|
|
|
print ""
|
|
|
|
print "#### Loopback configuration"
|
|
|
|
print "config interface loopback"
|
|
|
|
print " option ifname \"lo\""
|
|
|
|
print " option proto static"
|
|
|
|
print " option ipaddr 127.0.0.1"
|
|
|
|
print " option netmask 255.0.0.0"
|
|
|
|
print ""
|
|
|
|
print ""
|
|
|
|
print "#### LAN configuration"
|
|
|
|
print "config interface lan"
|
|
|
|
print " option type bridge"
|
|
|
|
p("ifname", "lan_ifname")
|
|
|
|
p("macaddr", "lan_macaddr")
|
|
|
|
print " option proto static"
|
|
|
|
print " option ipaddr 192.168.1.1"
|
|
|
|
print " option netmask 255.255.255.0"
|
|
|
|
print ""
|
|
|
|
print ""
|
|
|
|
print "#### WAN configuration"
|
|
|
|
print "config interface wan"
|
|
|
|
p("ifname", "wan_ifname")
|
|
|
|
p("macaddr", "wan_macaddr")
|
|
|
|
print " option proto dhcp"
|
|
|
|
}' > /etc/config/network
|
|
|
|
}
|
2008-03-18 03:16:32 +00:00
|
|
|
|