Hi.

>               switch)
> -                     local port_mask
> -                     json_get_vars port_mask
> +                     local port_mask speed_mask
> +                     json_get_vars port_mask speed_mask
>                       uci -q batch <<-EOF
>                               set system.$cfg.port_mask='$port_mask'
>                       EOF
> +                     if [ -n "$speed_mask" ] ; then
> +                             uci -q batch <<-EOF
> +                                     set system.$cfg.speed_mask='$speed_mask'

A batch "set" operation without a value results in a no-op so you can
drop the outer [ -n "$speed_mask" ] test and move the new set into the
existing batch.

> +                             EOF
> +                     fi

[...]

> @@ -419,6 +420,7 @@ ucidef_set_led_switch() {
>       json_add_string sysfs "$sysfs"
>       json_add_string trigger "$trigger"
>       json_add_string port_mask "$port_mask"
> +     [ -n "$speed_mask" ] && json_add_string speed_mask "$speed_mask"

Same here, empty values do not result in a new key within the json
object so the [ -n "$speed_mask" ] test is superfluous, just drop it.

>       json_select ..
>  
>       json_select ..
> 


~ Jow
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to