procd: procd_send_signal use signal names
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Tue, 2 Jan 2018 14:34:51 +0000 (14:34 +0000)
committerJo-Philipp Wich <jo@mein.io>
Tue, 2 Jan 2018 16:02:44 +0000 (17:02 +0100)
Usage documentation for 'procd_send_signal' states "The signal is SIGHUP
by default, and must be specified by NAME."  Make actual behaviour match
the stated documented behaviour.

https://wiki.openwrt.org/inbox/procd-init-scripts

Suggested-by: Jo-Philip Wich <jow@mein.io>
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
package/system/procd/Makefile
package/system/procd/files/procd.sh

index bffed81c90dc3b3350060a34aaa076f26c97aa73..7c8a1669b0b97a212ccbe0c2996278944bb46a09 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=procd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
index b8d3513b1e8d9eb2bfcfb3fb67d6bd7280e23b88..b4b6faa6627af447108bb6542d7c63af65e818a2 100644 (file)
@@ -413,6 +413,10 @@ _procd_send_signal() {
        local instance="$2"
        local signal="$3"
 
+       case "$signal" in
+               [A-Z]*) signal="$(kill -l "$signal" 2>/dev/null)" || return 1;;
+       esac
+
        json_init
        json_add_string name "$service"
        [ -n "$instance" -a "$instance" != "*" ] && json_add_string instance "$instance"