procd: Add wrapper for uci_validate_section()
[openwrt/openwrt.git] / package / system / procd / files / procd.sh
index 6f16b746ffb42c3c7eeba9fed628676a8eb3e761..72f25fe0c05bd284ee025d32c6aee09c1e4c074a 100644 (file)
@@ -486,6 +486,23 @@ uci_validate_section()
        return $_error
 }
 
+uci_load_validate() {
+       local _package="$1"
+       local _type="$2"
+       local _name="$3"
+       local _function="$4"
+       local _option
+       local _result
+       shift; shift; shift; shift
+       for _option in "$@"; do
+               eval "local ${_option%%:*}"
+       done
+       uci_validate_section "$_package" "$_type" "$_name" "$@"
+       _result=$?
+       [ -n "$_function" ] || return $_result
+       eval "$_function \"\$_name\" \"\$_result\""
+}
+
 _procd_wrapper \
        procd_open_service \
        procd_close_service \