aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-12-03 17:30:08 +0000
committerJo-Philipp Wich <jow@openwrt.org>2015-12-03 17:30:08 +0000
commit605c909287c19a334fb7fe2dd363392dd8d59e13 (patch)
treeb99fa76a65a2c8ad448f0bf46c6e24f3d2c95fa8
parent24cafca9b8b111507f4491cd2fd991ec29aa69f8 (diff)
downloadmaster-187ad058-605c909287c19a334fb7fe2dd363392dd8d59e13.tar.gz
master-187ad058-605c909287c19a334fb7fe2dd363392dd8d59e13.tar.bz2
master-187ad058-605c909287c19a334fb7fe2dd363392dd8d59e13.zip
base-files: uci-defaults-new: remove reset/enable args of ucidef_add_switch()
Out of 69 switch definitions, only 3 pass something different than "1" as values for reset and enable, with one of those three being invalid. This change ... * removes the reset and enable arguments from ucidef_add_switch() * unconditionally writes reset:1 and enable:1 to JSON * converts the three users of nonstandard values to ucidef_add_switch_attr() Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47720 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults-new.sh26
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/board.d/02_network3
-rwxr-xr-xtarget/linux/ramips/base-files/etc/board.d/02_network6
3 files changed, 18 insertions, 17 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults-new.sh b/package/base-files/files/lib/functions/uci-defaults-new.sh
index 4a7cca4df0..e652a8b521 100755
--- a/package/base-files/files/lib/functions/uci-defaults-new.sh
+++ b/package/base-files/files/lib/functions/uci-defaults-new.sh
@@ -84,16 +84,12 @@ ucidef_set_interfaces_lan_wan() {
ucidef_add_switch() {
local name="$1"
- local reset="$2"
- local enable="$3"
json_select_object switch
-
- json_select_object "$name"
- json_add_boolean enable "$enable"
- json_add_boolean reset "$reset"
- json_select ..
-
+ json_select_object "$name"
+ json_add_boolean enable 1
+ json_add_boolean reset 1
+ json_select ..
json_select ..
}
@@ -103,14 +99,15 @@ ucidef_add_switch_attr() {
local val="$3"
json_select_object switch
- json_select_object "$name"
+ json_select_object "$name"
- case "$val" in
- [0-9]) json_add_int "$key" "$val" ;;
- *) json_add_string "$key" "$val" ;;
- esac
+ case "$val" in
+ true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
+ [0-9]) json_add_int "$key" "$val" ;;
+ *) json_add_string "$key" "$val" ;;
+ esac
- json_select ..
+ json_select ..
json_select ..
}
@@ -273,6 +270,7 @@ ucidef_add_switch_port_attr() {
json_select_object attr
case "$val" in
+ true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
[0-9]) json_add_int "$key" "$val" ;;
*) json_add_string "$key" "$val" ;;
esac
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 72156b25cf..707f7d6798 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -348,7 +348,8 @@ dlan-pro-500-wp)
dlan-pro-1200-ac)
ucidef_set_interface_lan "eth0"
- ucidef_add_switch "switch0" "1" "0"
+ ucidef_add_switch "switch0"
+ ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_add_switch_ports "switch0" \
"0@eth0" "2:lan" "3:lan" "4:lan"
;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 16e7b6fa13..c8bdc77a69 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -52,7 +52,8 @@ ramips_setup_interfaces()
w150m|\
wnce2001|\
zte-q7)
- ucidef_add_switch "switch0" "1" "0"
+ ucidef_add_switch "switch0"
+ ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_set_interface_lan "eth0"
;;
3g-6200nl|\
@@ -186,7 +187,8 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
;;
m2m)
- ucidef_add_switch "switch0" "4"
+ ucidef_add_switch "switch0"
+ ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_set_interface_lan "eth0"
;;
mlwg2|\