Author: jow Date: 2015-12-03 18:30:08 +0100 (Thu, 03 Dec 2015) New Revision: 47720
Modified: trunk/package/base-files/files/lib/functions/uci-defaults-new.sh trunk/target/linux/ar71xx/base-files/etc/board.d/02_network trunk/target/linux/ramips/base-files/etc/board.d/02_network Log: 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 <[email protected]> Modified: trunk/package/base-files/files/lib/functions/uci-defaults-new.sh =================================================================== --- trunk/package/base-files/files/lib/functions/uci-defaults-new.sh 2015-12-03 16:25:19 UTC (rev 47719) +++ trunk/package/base-files/files/lib/functions/uci-defaults-new.sh 2015-12-03 17:30:08 UTC (rev 47720) @@ -84,17 +84,13 @@ 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_object "$name" + json_add_boolean enable 1 + json_add_boolean reset 1 + json_select .. json_select .. - - json_select .. } ucidef_add_switch_attr() { @@ -103,15 +99,16 @@ 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 .. } _ucidef_add_switch_port() { @@ -273,6 +270,7 @@ 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 Modified: trunk/target/linux/ar71xx/base-files/etc/board.d/02_network =================================================================== --- trunk/target/linux/ar71xx/base-files/etc/board.d/02_network 2015-12-03 16:25:19 UTC (rev 47719) +++ trunk/target/linux/ar71xx/base-files/etc/board.d/02_network 2015-12-03 17:30:08 UTC (rev 47720) @@ -348,7 +348,8 @@ 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" ;; Modified: trunk/target/linux/ramips/base-files/etc/board.d/02_network =================================================================== --- trunk/target/linux/ramips/base-files/etc/board.d/02_network 2015-12-03 16:25:19 UTC (rev 47719) +++ trunk/target/linux/ramips/base-files/etc/board.d/02_network 2015-12-03 17:30:08 UTC (rev 47720) @@ -52,7 +52,8 @@ 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 @@ "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|\ _______________________________________________ openwrt-commits mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits
