aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2018-11-28 22:12:23 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2018-11-29 14:50:40 +0000
commit5e1b34e01f97186fb694e7d80cd3183c76993930 (patch)
tree91a92bd232b9cd3fa21b7fe0f50d0764e6dee6e8
parent45bdd0edfb59595aa3ee975f4b1b2208e9fbda7a (diff)
downloadaports-5e1b34e01f97186fb694e7d80cd3183c76993930.tar.bz2
aports-5e1b34e01f97186fb694e7d80cd3183c76993930.tar.xz
main/mqtt-exec: initd use supervise-daemon
-rw-r--r--main/mqtt-exec/APKBUILD19
-rw-r--r--main/mqtt-exec/mqtt-exec.initd25
2 files changed, 16 insertions, 28 deletions
diff --git a/main/mqtt-exec/APKBUILD b/main/mqtt-exec/APKBUILD
index 1d2fe05e4e..a7700f6c91 100644
--- a/main/mqtt-exec/APKBUILD
+++ b/main/mqtt-exec/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mqtt-exec
pkgver=0.4
-pkgrel=2
+pkgrel=3
pkgdesc="simple MQTT client that executes a command on messages"
url="https://github.com/ncopa/mqtt-exec"
arch="all"
@@ -16,24 +16,15 @@ source="mqtt-exec-$pkgver.tar.gz::https://github.com/ncopa/mqtt-exec/archive/v$p
mqtt-exec.initd
"
-_builddir="$srcdir"/mqtt-exec-$pkgver
-prepare() {
- local i
- cd "$_builddir"
- for i in $source; do
- case $i in
- *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
- esac
- done
-}
+builddir="$srcdir"/mqtt-exec-$pkgver
build() {
- cd "$_builddir"
+ cd "$builddir"
make || return 1
}
package() {
- cd "$_builddir"
+ cd "$builddir"
install -D mqtt-exec "$pkgdir"/usr/bin/mqtt-exec || return 1
install -Dm755 "$srcdir"/mqtt-exec.initd \
"$pkgdir"/etc/init.d/mqtt-exec || return 1
@@ -41,4 +32,4 @@ package() {
sha512sums="1448b2dda0f27a5275c113331ea2bc073ec1740797c1bb5b472ee3e0fd4d3ef4bcdfa6dc42e7540ee154b291c3d70df89f0646899ebb1bfe585d1384797de5e7 mqtt-exec-0.4.tar.gz
418058ecc05922df186d0dcbfeab7656977256a143f0346406598d1cf7331d3ba95a9b004bf3b6581be2e3cb2fbf5e69d7954b4c7ac488863f0318506c7f1c7c 0001-authentication-expose-authentication-with-credential.patch
-b04b3f43d9079783d5a9af01aba49fa20431e528237e80790cd6ef89ea019d632866d1e2acfc619c3a90ed2cf4469422bac44727088392394792be68a6d13fae mqtt-exec.initd"
+5cec760ebf79d7dc309d8ef57ab76c132dc7008dd5e972403ed2433487cd4b649f0c23a1a515d985258b57893907c0a5124728bcd8c611899c68c16bd5c9cb1c mqtt-exec.initd"
diff --git a/main/mqtt-exec/mqtt-exec.initd b/main/mqtt-exec/mqtt-exec.initd
index 4b6b2c9627..92a64d8fb3 100644
--- a/main/mqtt-exec/mqtt-exec.initd
+++ b/main/mqtt-exec/mqtt-exec.initd
@@ -2,22 +2,24 @@
: ${mqtt_broker:="msg.alpinelinux.org"}
: ${mqtt_topics:="git/aports/$git_branch"}
-: ${exec_user:=nobody}
+: ${command_user:=nobody}
command=/usr/bin/mqtt-exec
-pidfile=/var/run/$SVCNAME/mqtt-exec.pid
+pidfile=/run/$SVCNAME/mqtt-exec.pid
+supervisor=supervise-daemon
+supervise_daemon_args="--stdout /dev/null --stderr /dev/null"
depend() {
need localmount net
after firewall
}
-start() {
- local topic
+start_pre() {
checkpath --directory --owner ${exec_user:-nobody} ${pidfile%/*}
+
set -- $command_args -h ${mqtt_broker} -v
- for topic in $mqtt_topics; do
- set -- "$@" -t "$topic"
+ local topic; for topic in $mqtt_topics; do
+ set -- "$@" -t "$topic"
done
if [ -n "$will_topic" ]; then
@@ -33,13 +35,8 @@ start() {
set -- "$@" --will-qos "$will_qos"
fi
- ebegin "Starting $SVCNAME"
- start-stop-daemon --start --stdout /dev/null --stderr /dev/null \
- --background --make-pid --user ${exec_user} \
- --pidfile ${pidfile} \
- --exec $command \
- -- "$@" \
- -- ${exec_command}
- eend
+ set -- "$@" -- ${exec_command}
+
+ command_args="$@"
}