diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 814ca748f..437751aad 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2018-11-23 -PKG_SOURCE_VERSION:=d6673547adc3768ce674799fa35952351866c9d0 -PKG_MIRROR_HASH:=ee11e1f652e9268e21dfd7835d26993c682ed33f6ba474c283cb9ef04f71e626 +PKG_SOURCE_DATE:=2019-05-30 +PKG_SOURCE_VERSION:=ade00ca585a49c8478bf60eb24ce385676be37a4 +PKG_MIRROR_HASH:=1417727ae6fcda01017e1bec3ec66e3e78116f9343cfe0256e40af54c52f2acc CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -45,6 +45,7 @@ define Package/procd CATEGORY:=Base system DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus TITLE:=OpenWrt system process manager + USERID:=:dialout=20 :audio=29 endef define Package/procd-ujail @@ -57,7 +58,7 @@ endef define Package/procd-seccomp SECTION:=base 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 endef diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json index 1c949bbea..f676bac79 100644 --- a/package/system/procd/files/hotplug.json +++ b/package/system/procd/files/hotplug.json @@ -20,6 +20,10 @@ [ "regex", "DEVNAME", "^snd" ], [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ] ], + [ "if", + [ "regex", "DEVNAME", "^tty" ], + [ "makedev", "/dev/%DEVNAME%", "0660", "dialout" ] + ], [ "if", [ "has", "DEVNAME" ], [ "makedev", "/dev/%DEVNAME%", "0600" ] diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index ab87eb2ab..a6a8fc12f 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -18,14 +18,21 @@ # file: configuration files (array) # netdev: bound network device (detects ifindex changes) # 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 +# 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 # # procd_close_instance(): # Complete the instance being prepared # +# procd_running(service, [instance]): +# Checks if service/instance is currently running +# # procd_kill(service, [instance]): # Kill a service instance (or all instances) # @@ -41,6 +48,7 @@ _PROCD_SERVICE= procd_lock() { local basescript=$(readlink "$initscript") local service_name="$(basename ${basescript:-$initscript})" + } _procd_call() { @@ -240,7 +248,7 @@ _procd_set_param() { reload_signal) json_add_int "$type" $(kill -l "$1") ;; - pidfile|user|seccomp|capabilities) + pidfile|user|group|seccomp|capabilities|facility) json_add_string "$type" "$1" ;; stdout|stderr|no_new_privs) @@ -389,6 +397,18 @@ _procd_add_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() { local service="$1" local instance="$2" @@ -477,6 +497,23 @@ uci_validate_section() 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_open_service \ procd_close_service \