aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorAlin Nastac <alin.nastac@gmail.com>2019-10-17 14:06:40 +0200
committerJo-Philipp Wich <jo@mein.io>2019-10-18 19:28:11 +0200
commitddf6ec29b477f0cf7ce7839c8c9710fb4b969621 (patch)
tree2a3cd962473fa3f8666c0d0166e5c432ed9ccd49 /package
parent91aabae8958d586a01eca6d47af579194f7c2116 (diff)
downloadupstream-ddf6ec29b477f0cf7ce7839c8c9710fb4b969621.tar.gz
upstream-ddf6ec29b477f0cf7ce7839c8c9710fb4b969621.tar.bz2
upstream-ddf6ec29b477f0cf7ce7839c8c9710fb4b969621.zip
procd: allow usage of * as procd_running() instance parameter
service_running() implementation in /etc/rc.common use it. It is preferable to use wildcard than assuming the instance name is the default one. jsonfilter returns all matches when wildcards are used, hence the -l 1 argument used to limit output to only one value. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
Diffstat (limited to 'package')
-rw-r--r--package/system/procd/Makefile2
-rw-r--r--package/system/procd/files/procd.sh6
2 files changed, 4 insertions, 4 deletions
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index 8ff2996262..27702efc51 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=procd
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 014b4499e1..b8f9a210f6 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -407,12 +407,12 @@ _procd_add_instance() {
procd_running() {
local service="$1"
- local instance="${2:-instance1}"
- local running
+ local instance="${2:-*}"
+ [ "$instance" = "*" ] || instance="'$instance'"
json_init
json_add_string name "$service"
- running=$(_procd_ubus_call list | jsonfilter -e "@['$service'].instances['$instance'].running")
+ local running=$(_procd_ubus_call list | jsonfilter -l 1 -e "@['$service'].instances[$instance].running")
[ "$running" = "true" ]
}