ports/net-im/py-matrix-synapse/files/synapse.in
Sascha Biberhofer 6e79c8a268
net-im/py-matrix-synapse: Fix rc.d script
rc.d script doesn't use synapse_user variable in start_precmd

PR:		262692
Reported by:	Marcin Gryszkalis <mg at fork dot pl>
2022-03-26 15:44:32 +00:00

48 lines
1 KiB
Bash

#!/bin/sh
#
# Created by: Mark Felder <feld@FreeBSD.org>
# PROVIDE: synapse
# REQUIRE: LOGIN postgresql
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable `synapse':
#
# synapse_enable="YES"
. /etc/rc.subr
name=synapse
rcvar=synapse_enable
load_rc_config ${name}
: ${synapse_enable:=NO}
: ${synapse_user:=%%USERS%%}
: ${synapse_conf:=%%ETCDIR%%/homeserver.yaml}
: ${synapse_dbdir:=%%DBDIR%%}
: ${synapse_logdir:=%%LOGDIR%%}
: ${synapse_pidfile:=%%PIDDIR%%/homeserver.pid}
pidfile="${synapse_pidfile}"
procname=%%PYTHON_CMD%%
command=%%PYTHON_CMD%%
command_args="-m synapse.app.homeserver --daemonize -c ${synapse_conf}"
start_precmd=start_precmd
start_precmd()
{
if [ ! -d ${synapse_pidfile%/*} ] ; then
install -d -o ${synapse_user} -g wheel ${synapse_pidfile%/*};
fi
if [ ! -d ${synapse_dbdir} ] ; then
install -d -o ${synapse_user} -g wheel ${synapse_dbdir};
fi
if [ ! -d ${synapse_logdir} ] ; then
install -d -o ${synapse_user} -g wheel ${synapse_logdir};
fi
}
run_rc_command "$1"