mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-29 03:28:14 +02:00
44 lines
982 B
Bash
44 lines
982 B
Bash
#!/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_background="yes"
|
|
pidfile="/run/$RC_SVCNAME/mqtt-exec.pid"
|
|
supervise_daemon_args="--stdout /dev/null --stderr /dev/null"
|
|
|
|
depend() {
|
|
need localmount net
|
|
after firewall
|
|
}
|
|
|
|
start_pre() {
|
|
checkpath --directory --owner "${command_user:-nobody}" "${pidfile%/*}"
|
|
|
|
set -- $command_args -h ${mqtt_broker} -v
|
|
local topic; for topic in $mqtt_topics; do
|
|
set -- "$@" -t "$topic"
|
|
done
|
|
|
|
if [ -n "$will_topic" ]; then
|
|
set -- "$@" --will-topic "$will_topic"
|
|
fi
|
|
if yesno "$will_retain"; then
|
|
set -- "$@" --will-retain
|
|
fi
|
|
if [ -n "$will_payload" ]; then
|
|
set -- "$@" --will-payload "$will_payload"
|
|
fi
|
|
if [ -n "$will_qos" ]; then
|
|
set -- "$@" --will-qos "$will_qos"
|
|
fi
|
|
if [ -n "$mqtt_user" ]; then
|
|
set -- "$@" --username "$mqtt_user"
|
|
fi
|
|
|
|
set -- "$@" -- ${exec_command}
|
|
|
|
command_args="$@"
|
|
}
|