aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-05-21 08:33:04 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-05-21 09:20:19 +0000
commit31528e07ff2c57fa794d3e6dfafa1ee7ee858742 (patch)
tree535dcc85316cfd53a8289ce5641d6097f0b1e5b1
parent4456c9ec91d13627b3900075f8ac84ce97551679 (diff)
downloadaports-31528e07ff2c57fa794d3e6dfafa1ee7ee858742.tar.bz2
aports-31528e07ff2c57fa794d3e6dfafa1ee7ee858742.tar.xz
main/mqtt-exec: upgrade to 0.2 and add an init.d script
(cherry picked from commit 725aa8296389545202816c164b5905a02f772c5a)
-rw-r--r--main/mqtt-exec/APKBUILD22
-rw-r--r--main/mqtt-exec/mqtt-exec.initd40
2 files changed, 52 insertions, 10 deletions
diff --git a/main/mqtt-exec/APKBUILD b/main/mqtt-exec/APKBUILD
index 7ec28c19e4..3c66a5dd7a 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.1
-pkgrel=1
+pkgver=0.2
+pkgrel=0
pkgdesc="simple MQTT client that executes a command on messages"
url="https://github.com/ncopa/mqtt-exec"
arch="all"
@@ -12,7 +12,7 @@ makedepends="$depends_dev mosquitto-dev"
install=""
subpackages=""
source="mqtt-exec-$pkgver.tar.gz::https://github.com/ncopa/mqtt-exec/archive/v$pkgver.tar.gz
- 0001-implement-v-verbose-to-optionally-pass-the-the-topic.patch
+ mqtt-exec.initd
"
_builddir="$srcdir"/mqtt-exec-$pkgver
@@ -33,12 +33,14 @@ build() {
package() {
cd "$_builddir"
- install -D mqtt-exec "$pkgdir"/usr/bin/mqtt-exec
+ 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
}
-md5sums="1e78b343ecd7cc64d2771dcd04dfc2d7 mqtt-exec-0.1.tar.gz
-e9d27542d0143c70f5e5b4551f866947 0001-implement-v-verbose-to-optionally-pass-the-the-topic.patch"
-sha256sums="4a62dc42131ba9c2ba418818e7394981c81c8f0a53cc31619a7d45247f6d376e mqtt-exec-0.1.tar.gz
-115425b2b941b7c7065bf256b8be3e3505f3a2a3e9bbfdf29a598b82b86bd705 0001-implement-v-verbose-to-optionally-pass-the-the-topic.patch"
-sha512sums="583d02e7d1a0b7cb7bb9a249a7581109d0d48b6c9a0acc77022cfe2e8db56f8295a41c9374b0671343a215280b1d8cf36346501cabae157d6235170b7ee7d6ea mqtt-exec-0.1.tar.gz
-6202ea282362232b3d857d50d8d7aa2310f0f6bbc828997f02084f65f1aa65f229629a86ad9092e51768e5f8acbd7945b46bad373b22a54f216e97ea57e394fa 0001-implement-v-verbose-to-optionally-pass-the-the-topic.patch"
+md5sums="7f31cfcfeb5e996870709980ac96d678 mqtt-exec-0.2.tar.gz
+2b2088540f78a60e0fd5d2c2961444af mqtt-exec.initd"
+sha256sums="a944064360622224667d16cea81b47daf66eb92bbdbb4c25cad8f0e21a6e4c1f mqtt-exec-0.2.tar.gz
+9f7dc584a9f5db9fc2bfb74d78242f7aba18ddfb729a863c9a3b223673c1a3b3 mqtt-exec.initd"
+sha512sums="45775cb53c70eff10b4c75e5aebbb047800c158b367944dfead20aefeafd3e9908bff84594c0fa20a9a3cc8f3f6067e3ebc734d5d984c9df1bfbdcab1a4ec0a5 mqtt-exec-0.2.tar.gz
+8e12fe24476dc7564c164bdb90bf9603796ffafb931dbc3d807f8f78cc271d65b98015447920d116dc12c96240272b01223574c607e8998f0da377164dba3516 mqtt-exec.initd"
diff --git a/main/mqtt-exec/mqtt-exec.initd b/main/mqtt-exec/mqtt-exec.initd
new file mode 100644
index 0000000000..727ee203af
--- /dev/null
+++ b/main/mqtt-exec/mqtt-exec.initd
@@ -0,0 +1,40 @@
+#!/sbin/runscript
+
+: ${mqtt_broker:="msg.alpinelinux.org"}
+: ${mqtt_topics:="git/aports/$git_branch"}
+: ${exec_user:=nobody}
+
+command=/usr/bin/mqtt-exec
+pidfile=/var/run/$SVCNAME/mqtt-exec.pid
+
+start() {
+ local topic
+ checkpath --directory --owner ${exec_user:-nobody} ${pidfile%/*}
+ set -- -h ${mqtt_broker} -v
+ for topic in $mqtt_topics; do
+ set -- "$@" -t "$topic"
+ done
+
+ if [ -n "$will_topic" ]; then
+ set -- "$@" --will-topic "$will_topic"
+ fi
+ if yesno "$will_retained"; then
+ set -- "$@" --will-retained
+ fi
+ if [ -n "$will_payload" ]; then
+ set -- "$@" --will-payload "$will_payload"
+ fi
+ if [ -n "$will_qos" ]; then
+ 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
+}
+