main/mqtt-exec: fix init script, don't force supervise-daemon

Allow users to disable via conf.d file.
This commit is contained in:
Jakub Jirutka 2023-12-06 13:18:24 +01:00 committed by Natanael Copa
parent 090b68db1d
commit 2b9f3eec18
3 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mqtt-exec
pkgver=0.5
pkgrel=1
pkgrel=2
pkgdesc="simple MQTT client that executes a command on messages"
url="https://github.com/ncopa/mqtt-exec"
arch="all"
@ -26,6 +26,6 @@ package() {
sha512sums="
55746aabe17d47153c01549a65f0db9278a39dc642e355b8416e905934a3abe233eb0ad763ae8add08bf6c3ad8ccaa97e9bac4372c8af6fea522f6670378acd7 mqtt-exec-0.5.tar.gz
f8cab7fe709fc80b3a75f1d65d55e10c05a4b27e319a9190d3ee78050fea86d8c6512e3d624b8b413dab01b2043bed5f672453090251b93d261d79125f9f0d17 mqtt-exec.initd
e5cce69f5ad1f0fcf0eb0be7675c2f4ca4ba5518e8303adb16673b7e402dbe8d48b57c4b4512a0d3aba4541241d2ddeca68b88354d089606f67a5549508b44b5 mqtt-exec.confd
1e156a06872223cdcf607a3d5ee1f2603c887d83068cc57dddcd7d9e1fc44c2319bbf63befd394cedf7c105fabd2e2e9a493b7c0d7c6c30f5f485dcfa43ea660 mqtt-exec.initd
f402e7a44d69a8fc09aa46a9922a68b21264281d69deeb61bdb8ec842b3f9c1ef8b7d83826997f9722c84f8ab15631dfdc55d9cfc416b3db1613c3ddcd53330e mqtt-exec.confd
"

View File

@ -1,3 +1,5 @@
# Configuration for /etc/init.d/mqtt-exec
# The MQTT broker to connect to
#mqtt_broker=msg.alpinelinux.org
@ -21,3 +23,6 @@
# Password for the user
#export MQTT_EXEC_PASSWORD=
# Run with process supervisor. If you want to disable it, comment it out.
supervisor=supervise-daemon

View File

@ -1,12 +1,11 @@
#!/sbin/openrc-run
: ${command_user:="${exec_user:-nobody}"}
: ${mqtt_broker:="msg.alpinelinux.org"}
: ${mqtt_topics:="git/aports/$git_branch"}
command=/usr/bin/mqtt-exec
command_user="${exec_user:-nobody}"
pidfile=/run/$SVCNAME/mqtt-exec.pid
supervisor=supervise-daemon
command="/usr/bin/mqtt-exec"
pidfile="/run/$RC_SVCNAME/mqtt-exec.pid"
supervise_daemon_args="--stdout /dev/null --stderr /dev/null"
depend() {
@ -15,7 +14,7 @@ depend() {
}
start_pre() {
checkpath --directory --owner ${exec_user:-nobody} ${pidfile%/*}
checkpath --directory --owner "${command_user:-nobody}" "${pidfile%/*}"
set -- $command_args -h ${mqtt_broker} -v
local topic; for topic in $mqtt_topics; do
@ -42,4 +41,3 @@ start_pre() {
command_args="$@"
}