add config file support for the adm5120 switch
[openwrt/svn-archive/archive.git] / package / admswconfig / files / admswswitch.sh
diff --git a/package/admswconfig/files/admswswitch.sh b/package/admswconfig/files/admswswitch.sh
new file mode 100644 (file)
index 0000000..c5898d5
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
+setup_switch_vlan() {
+       config_get ports "$CONFIG_SECTION" "eth$1"
+       admswconfig eth$1 ${ports}c
+}
+
+setup_switch() {
+       config_cb() {
+               case "$1" in
+                       switch)
+                               option_cb() {
+                                       case "$1" in
+                                               eth*) setup_switch_vlan "${1##eth}";;
+                                       esac
+                               }
+                       ;;
+                       *)
+                               option_cb() { return 0; }
+                       ;;
+               esac
+       }
+       config_load network
+}