aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorPierre Lebleu <pme.lebleu@gmail.com>2017-10-25 18:05:15 +0200
committerJohn Crispin <john@phrozen.org>2017-11-10 23:31:27 +0100
commit832b6b8305f738fe7a5efbefc1ce48a062b0deda (patch)
tree2b524470af5e189e6b9646ca6b793146274087b3 /package
parentff56bb0dfb2ccdfc82ade6f80ad201268717d9fe (diff)
downloadupstream-832b6b8305f738fe7a5efbefc1ce48a062b0deda.tar.gz
upstream-832b6b8305f738fe7a5efbefc1ce48a062b0deda.tar.bz2
upstream-832b6b8305f738fe7a5efbefc1ce48a062b0deda.zip
procd: service_data: Support data within the service itself
Use the same approach than the service_triggers for the service_data. Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/etc/rc.common4
-rw-r--r--package/system/procd/files/procd.sh15
2 files changed, 19 insertions, 0 deletions
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index e80af891e6..a2ea6a5679 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -88,6 +88,10 @@ service_triggers() {
return 0
}
+service_data() {
+ return 0
+}
+
service_running() {
return 0
}
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index c23c37b83f..91e2371d62 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -79,6 +79,9 @@ _procd_close_service() {
_procd_open_trigger
service_triggers
_procd_close_trigger
+ _procd_open_data
+ service_data
+ _procd_close_data
_procd_ubus_call ${1:-set}
}
@@ -134,6 +137,18 @@ _procd_close_trigger() {
json_close_array
}
+_procd_open_data() {
+ let '_procd_data_open = _procd_data_open + 1'
+ [ "$_procd_data_open" -gt 1 ] && return
+ json_add_object "data"
+}
+
+_procd_close_data() {
+ let '_procd_data_open = _procd_data_open - 1'
+ [ "$_procd_data_open" -lt 1 ] || return
+ json_close_object
+}
+
_procd_open_validate() {
json_select ..
json_add_array "validate"