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)
committerRafał Miłecki <rafal@milecki.pl>
Tue, 11 Dec 2018 20:30:54 +0000 (21:30 +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>
(cherry picked from commit 37bb463daa21e2c97365c6543b2bfdfe673c5baa)

package/system/procd/Makefile
package/system/procd/files/procd.sh

index b905cb25aa02c4c3f82cbc288ef15648dfd66444..d7b3e47fdbbd96138140a24c879a34e16852971d 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 e6ca8a6bc924fe65d8832f96a203d0a6edabf987..36388adaed8e0d74ea7e7118ec32dc536e1bb6fc 100644 (file)
@@ -383,6 +383,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"