fix broken init file and some cleanup
authorTravis Kemen <thepeople@openwrt.org>
Tue, 18 Mar 2008 03:16:32 +0000 (03:16 +0000)
committerTravis Kemen <thepeople@openwrt.org>
Tue, 18 Mar 2008 03:16:32 +0000 (03:16 +0000)
SVN-Revision: 10613

package/admswconfig/files/admswconfig
package/admswconfig/files/admswswitch.sh

index dd55242500870fb13b65be6a66e152a3c5e11fcd..d3a0565569a181706bbfefcb94cecab0e87fc9cc 100644 (file)
@@ -8,30 +8,34 @@ start() {
 
        mkdir -p /etc/config
 
-adm5120_detect() {
        board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
 
        case "$board_name" in
        "Compex WP54"*)
-               board="WP54";;
+               board="Compex WP54";;
        *)
                ;;
        esac
-}
 
-adm5120_detect
+       echo "$board" |awk '
+       board=$1
+
+       function p(cfgname, name) {
+               if (c[name] != "") print "      option " cfgname "      \"" c[name] "\""
+       }
+
        BEGIN {
                FS="="
                c["lan_ifname"]="eth0"
                c["wan_ifname"]="eth1"
-               c["eth0ports"]="12345"
+               c["eth0ports"]="1 2 3 4 5"
                c["eth1ports"]="0"
        }
 
        END {
-               if (model == "Compex WP54") {
-                       c["vlan0ports"]="0"
-                       c["vlan1ports"]="1"
+               if (board == "Compex WP54") {
+                       c["eth0ports"]="0"
+                       c["eth1ports"]="1"
                }
 
                print "#### VLAN configuration "
@@ -65,3 +69,4 @@ adm5120_detect
                print " option proto    dhcp"
        }' > /etc/config/network
 }
+
index c5898d5a392fd339a583fc39a3a9d702d6f30cc8..32a60a82bf2f191a6564ae0773aefcb95d649d30 100644 (file)
@@ -3,6 +3,7 @@
 
 setup_switch_vlan() {
        config_get ports "$CONFIG_SECTION" "eth$1"
+       ports=`echo "$ports"| sed s/" "/""/g`
        admswconfig eth$1 ${ports}c
 }