summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-07-04 13:30:55 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-07-04 13:30:55 +0000
commitdebeea2fbcb11a5962107ff79de8ece93a530dcd (patch)
tree1ce7354306bcdfec174fa2033138bb2d600c07dd
parent7c5affc2c73162b2487733e2f948393d276517b5 (diff)
procd: extend shell binding with trigger support
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37157 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/system/procd/files/procd.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index e771e0c156..3f1311ca87 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -109,6 +109,10 @@ _procd_open_instance() {
json_add_object "$name"
}
+_procd_open_trigger() {
+ json_add_array "triggers"
+}
+
_procd_set_param() {
local type="$1"; shift
@@ -125,6 +129,27 @@ _procd_set_param() {
esac
}
+_procd_add_config_trigger() {
+ json_add_array
+ _procd_add_array_data "config.change"
+
+ json_add_array
+ _procd_add_array_data "if"
+
+ json_add_array
+ _procd_add_array_data "eq" "package" "$1"
+ shift
+ json_close_array
+
+ json_add_array
+ _procd_add_array_data "run_script" "$@"
+ json_close_array
+
+ json_close_array
+
+ json_close_array
+}
+
_procd_append_param() {
local type="$1"; shift
@@ -144,6 +169,10 @@ _procd_close_instance() {
json_close_object
}
+_procd_close_trigger() {
+ json_close_array
+}
+
_procd_add_instance() {
_procd_open_instance
_procd_set_command "$@"
@@ -164,6 +193,9 @@ _procd_wrapper \
procd_open_service \
procd_close_service \
procd_add_instance \
+ procd_add_config_trigger \
+ procd_open_trigger \
+ procd_close_trigger \
procd_open_instance \
procd_close_instance \
procd_set_param \