aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/bin/config_generate
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-10-27 15:51:17 +0000
committerJohn Crispin <john@openwrt.org>2014-10-27 15:51:17 +0000
commit5a6433cc6ce6cc833cf6f27463d0b85e4d7587a5 (patch)
treef53b3f9b1f6a707f3c184ae9d3f220e4c9ef5ced /package/base-files/files/bin/config_generate
parent6149caf01e86ba10a46007446e6e502fde11b543 (diff)
downloadupstream-5a6433cc6ce6cc833cf6f27463d0b85e4d7587a5.tar.gz
upstream-5a6433cc6ce6cc833cf6f27463d0b85e4d7587a5.tar.bz2
upstream-5a6433cc6ce6cc833cf6f27463d0b85e4d7587a5.zip
base-files: config_generate did not handle setups with more than 1 switch properly
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43088
Diffstat (limited to 'package/base-files/files/bin/config_generate')
-rwxr-xr-xpackage/base-files/files/bin/config_generate9
1 files changed, 4 insertions, 5 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 9a3b30065d..7bec566f3f 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -102,8 +102,6 @@ generate_switch() {
json_select $key
json_get_vars enable reset blinkrate cpu_port
- [ -n "$cpu_port" ] || return
-
uci -q batch <<EOF
add network switch
set network.@switch[-1].name='$key'
@@ -111,9 +109,10 @@ set network.@switch[-1].reset='$reset'
set network.@switch[-1].enable_vlan='$enable'
set network.@switch[-1].blinkrate='$blinkrate'
EOF
-
- json_get_keys vlans vlans
- for vlan in $vlans; do generate_switch_vlan $1 $vlan $cpu_port; done
+ [ -n "$cpu_port" ] && {
+ json_get_keys vlans vlans
+ for vlan in $vlans; do generate_switch_vlan $1 $vlan $cpu_port; done
+ }
json_select ..
json_select ..
}