aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions
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
commitd17a64c7c01e2f0bb79123250ec6ea5f4fb8ec6e (patch)
treee35582c364a6ddcd47074324a634d4a3c093131e /package/base-files/files/lib/functions
parent80f767d09390e69baeeca3f039e2b44bad4c6913 (diff)
downloadupstream-d17a64c7c01e2f0bb79123250ec6ea5f4fb8ec6e.tar.gz
upstream-d17a64c7c01e2f0bb79123250ec6ea5f4fb8ec6e.tar.bz2
upstream-d17a64c7c01e2f0bb79123250ec6ea5f4fb8ec6e.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> SVN-Revision: 47720
Diffstat (limited to 'package/base-files/files/lib/functions')
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults-new.sh26
1 files changed, 12 insertions, 14 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