procd: update to latest git HEAD

This commit is contained in:
LEAN-ESX 2019-05-31 07:25:47 -07:00
parent 63bfcf90e1
commit 5e1b0154fb
3 changed files with 48 additions and 6 deletions

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_SOURCE_DATE:=2018-11-23 PKG_SOURCE_DATE:=2019-05-30
PKG_SOURCE_VERSION:=d6673547adc3768ce674799fa35952351866c9d0 PKG_SOURCE_VERSION:=ade00ca585a49c8478bf60eb24ce385676be37a4
PKG_MIRROR_HASH:=ee11e1f652e9268e21dfd7835d26993c682ed33f6ba474c283cb9ef04f71e626 PKG_MIRROR_HASH:=1417727ae6fcda01017e1bec3ec66e3e78116f9343cfe0256e40af54c52f2acc
CMAKE_INSTALL:=1 CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
@ -45,6 +45,7 @@ define Package/procd
CATEGORY:=Base system CATEGORY:=Base system
DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus
TITLE:=OpenWrt system process manager TITLE:=OpenWrt system process manager
USERID:=:dialout=20 :audio=29
endef endef
define Package/procd-ujail define Package/procd-ujail
@ -57,7 +58,7 @@ endef
define Package/procd-seccomp define Package/procd-seccomp
SECTION:=base SECTION:=base
CATEGORY:=Base system CATEGORY:=Base system
DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@powerpc||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
TITLE:=OpenWrt process seccomp helper + utrace TITLE:=OpenWrt process seccomp helper + utrace
endef endef

View File

@ -20,6 +20,10 @@
[ "regex", "DEVNAME", "^snd" ], [ "regex", "DEVNAME", "^snd" ],
[ "makedev", "/dev/%DEVNAME%", "0660", "audio" ] [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ]
], ],
[ "if",
[ "regex", "DEVNAME", "^tty" ],
[ "makedev", "/dev/%DEVNAME%", "0660", "dialout" ]
],
[ "if", [ "if",
[ "has", "DEVNAME" ], [ "has", "DEVNAME" ],
[ "makedev", "/dev/%DEVNAME%", "0600" ] [ "makedev", "/dev/%DEVNAME%", "0600" ]

View File

@ -18,14 +18,21 @@
# file: configuration files (array) # file: configuration files (array)
# netdev: bound network device (detects ifindex changes) # netdev: bound network device (detects ifindex changes)
# limits: resource limits (passed to the process) # limits: resource limits (passed to the process)
# user info: array with 1 values $username # user: $username to run service as
# group: $groupname to run service as
# pidfile: file name to write pid into # pidfile: file name to write pid into
# stdout: boolean whether to redirect commands stdout to syslog (default: 0)
# stderr: boolean whether to redirect commands stderr to syslog (default: 0)
# facility: syslog facility used when logging to syslog (default: daemon)
# #
# No space separation is done for arrays/tables - use one function argument per command line argument # No space separation is done for arrays/tables - use one function argument per command line argument
# #
# procd_close_instance(): # procd_close_instance():
# Complete the instance being prepared # Complete the instance being prepared
# #
# procd_running(service, [instance]):
# Checks if service/instance is currently running
#
# procd_kill(service, [instance]): # procd_kill(service, [instance]):
# Kill a service instance (or all instances) # Kill a service instance (or all instances)
# #
@ -41,6 +48,7 @@ _PROCD_SERVICE=
procd_lock() { procd_lock() {
local basescript=$(readlink "$initscript") local basescript=$(readlink "$initscript")
local service_name="$(basename ${basescript:-$initscript})" local service_name="$(basename ${basescript:-$initscript})"
} }
_procd_call() { _procd_call() {
@ -240,7 +248,7 @@ _procd_set_param() {
reload_signal) reload_signal)
json_add_int "$type" $(kill -l "$1") json_add_int "$type" $(kill -l "$1")
;; ;;
pidfile|user|seccomp|capabilities) pidfile|user|group|seccomp|capabilities|facility)
json_add_string "$type" "$1" json_add_string "$type" "$1"
;; ;;
stdout|stderr|no_new_privs) stdout|stderr|no_new_privs)
@ -389,6 +397,18 @@ _procd_add_instance() {
_procd_close_instance _procd_close_instance
} }
procd_running() {
local service="$1"
local instance="${2:-instance1}"
local running
json_init
json_add_string name "$service"
running=$(_procd_ubus_call list | jsonfilter -e "@.$service.instances.${instance}.running")
[ "$running" = "true" ]
}
_procd_kill() { _procd_kill() {
local service="$1" local service="$1"
local instance="$2" local instance="$2"
@ -477,6 +497,23 @@ uci_validate_section()
return $_error return $_error
} }
uci_load_validate() {
local _package="$1"
local _type="$2"
local _name="$3"
local _function="$4"
local _option
local _result
shift; shift; shift; shift
for _option in "$@"; do
eval "local ${_option%%:*}"
done
uci_validate_section "$_package" "$_type" "$_name" "$@"
_result=$?
[ -n "$_function" ] || return $_result
eval "$_function \"\$_name\" \"\$_result\""
}
_procd_wrapper \ _procd_wrapper \
procd_open_service \ procd_open_service \
procd_close_service \ procd_close_service \