Nils Freydank
163ef0a26e
Upstream dropped the polylith mode in 0.12.0 as announced in earlier releases. This leads to some renaming of files, see e.g. upstream issue 2975[1]. As I've got no OpenRC system or container right now I can't test the modified OpenRC init scripts. In case you have one feedback either way is appreciated - confirmations that it's working, bug reports if it failes or even just suggestions for improvement. As the ebuild didn't build (failed in the install phase) before this fixup there is no revbump necessary. This commit also adds an service file which is based upon upstream's example for their monolith setup (but with paths in /usr instead of opt)[2]. [1] https://github.com/matrix-org/dendrite/issues/2975 [2] https://github.com/matrix-org/dendrite/blob/main/docs/systemd/monolith-example.service Signed-off-by: Nils Freydank <nils.freydank@posteo.de>
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
#!/sbin/openrc-run
|
|
|
|
DENDRITE=${SVCNAME#*.}
|
|
: ${DENDRITE_CONFDIR:=${RC_PREFIX%/}/etc/dendrite}
|
|
|
|
if [ -n "${DENDRITE}" ] && [ ${SVCNAME} != "dendrite" ]; then
|
|
: ${DENDRITE_CONFIG:=${DENDRITE_CONFDIR}/${DENDRITE}.yaml}
|
|
: ${DENDRITE_PIDFILE:=${RC_PREFIX%/}/run/dendrite.${DENDRITE}.pid}
|
|
: ${DENDRITE_RC_CONFIG:=${RC_PREFIX%/}/etc/conf.d/dendrite.${DENDRITE}}
|
|
else
|
|
: ${DENDRITE_CONFIG:=${DENDRITE_CONFDIR}/dendrite.yaml}
|
|
: ${DENDRITE_PIDFILE:=${RC_PREFIX%/}/run/${SVCNAME}.pid}
|
|
: ${DENDRITE_RC_CONFIG:=${RC_PREFIX%/}/etc/conf.d/dendrite}
|
|
fi
|
|
|
|
command="${RC_PREFIX%/}/usr/bin/dendrite"
|
|
|
|
pidfile="${DENDRITE_PIDFILE}"
|
|
command_background=true
|
|
command_user="dendrite:dendrite"
|
|
directory="/var/lib/dendrite"
|
|
command_args="${DENDRITE_OPTS} -config ${DENDRITE_CONFIG}"
|
|
|
|
checkconfig() {
|
|
test -f "${DENDRITE_CONFIG}" || {
|
|
echo "\"${DENDRITE_CONFIG}\" does not exist or is not a regular file." >&2
|
|
echo "Please, look at https://github.com/matrix-org/dendrite for instructions" >&2
|
|
echo "on how to configure your dendrite instance, and use" >&2
|
|
echo "\"${DENDRITE_CONFIDR}/dendrite-config-example.yaml\" as an example." >&2
|
|
return 1
|
|
}
|
|
}
|
|
|
|
start_pre() {
|
|
# If this isn't a restart, make sure that the user's config isn't
|
|
# busted before we try to start the daemon (this will produce
|
|
# better error messages than if we just try to start it blindly).
|
|
#
|
|
# If, on the other hand, this *is* a restart, then the stop_pre
|
|
# action will have ensured that the config is usable and we don't
|
|
# need to do that again.
|
|
if [ "${RC_CMD}" != "restart" ] ; then
|
|
checkconfig || return $?
|
|
fi
|
|
}
|
|
|
|
stop_pre() {
|
|
# If this is a restart, check to make sure the user's config
|
|
# isn't busted before we stop the running daemon.
|
|
if [ "${RC_CMD}" = "restart" ] ; then
|
|
checkconfig || return $?
|
|
fi
|
|
}
|