pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
matrix-synapse: Add rc.d script
Module Name: pkgsrc-wip
Committed By: Jonathan Schleifer <js%nil.im@localhost>
Pushed By: js
Date: Sun Aug 16 23:50:07 2020 +0200
Changeset: 6948c90bd5a3b176ba1fad5b3acdf72d5c19c0cc
Modified Files:
matrix-synapse/MESSAGE
matrix-synapse/Makefile
Added Files:
matrix-synapse/files/matrix-synapse.sh
Log Message:
matrix-synapse: Add rc.d script
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=6948c90bd5a3b176ba1fad5b3acdf72d5c19c0cc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
matrix-synapse/MESSAGE | 4 +++-
matrix-synapse/Makefile | 21 ++++++++++++++++++++-
matrix-synapse/files/matrix-synapse.sh | 23 +++++++++++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
diffs:
diff --git a/matrix-synapse/MESSAGE b/matrix-synapse/MESSAGE
index dae117289d..78b1e631d7 100644
--- a/matrix-synapse/MESSAGE
+++ b/matrix-synapse/MESSAGE
@@ -3,9 +3,11 @@ $NetBSD$
To generate a Synapse configuration, run:
+cd ${SYNAPSE_DATA} &&
${PYTHONBIN} -m synapse.app.homeserver \
--server-name my.domain.name \
- --config-path ${PREFIX}/etc/matrix-synapse/homeserver.yaml \
+ --config-path ${PKG_SYSCONFDIR}/matrix-synapse/homeserver.yaml \
+ --config-directory ${PKG_SYSCONFDIR}/matrix-synapse \
--generate-config \
--report-stats=no
===========================================================================
diff --git a/matrix-synapse/Makefile b/matrix-synapse/Makefile
index c683a0e604..62a6fbaaef 100644
--- a/matrix-synapse/Makefile
+++ b/matrix-synapse/Makefile
@@ -47,8 +47,27 @@ WRKSRC= ${WRKDIR}/synapse-${DISTNAME:S,^v,,}
USE_LANGUAGES= # none
REPLACE_PERL+= scripts/sync_room_to_group.pl
-MESSAGE_SUBST+= PREFIX=${PREFIX:Q}
+SYNAPSE_USER?= synapse
+SYNAPSE_GROUP?= ${SYNAPSE_USER}
+SYNAPSE_DATA?= ${VARBASE}/db/matrix-synapse
+
+OWN_DIRS_PERMS+= ${SYNAPSE_DATA} ${SYNAPSE_USER} ${SYNAPSE_GROUP} 0770
+
+PKG_USERS_VARS= SYNAPSE_USER
+PKG_GROUPS_VARS= SYNAPSE_GROUP
+PKG_GROUPS= ${SYNAPSE_GROUP}
+PKG_USERS= ${SYNAPSE_USER}:${SYNAPSE_GROUP}
+PKG_GECOS.${SYNAPSE_USER}= Synapse daemon user
+PKG_HOME.${SYNAPSE_USER}= ${SYNAPSE_DATA}
+PKG_SHELL.${SYNAPSE_USER}= ${NOLOGIN}
+
+RCD_SCRIPTS= matrix-synapse
+
+FILES_SUBST+= SYNAPSE_DATA=${SYNAPSE_DATA:Q}
+FILES_SUBST+= SYNAPSE_USER=${SYNAPSE_USER:Q}
+MESSAGE_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
MESSAGE_SUBST+= PYTHONBIN=${PYTHONBIN:Q}
+MESSAGE_SUBST+= SYNAPSE_DATA=${SYNAPSE_DATA:Q}
.include "../../lang/python/egg.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/matrix-synapse/files/matrix-synapse.sh b/matrix-synapse/files/matrix-synapse.sh
new file mode 100644
index 0000000000..27b1e65654
--- /dev/null
+++ b/matrix-synapse/files/matrix-synapse.sh
@@ -0,0 +1,23 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: matrix-synapse
+# REQUIRE: DAEMON
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="matrix-synapse"
+rcvar="matrix_synapse"
+ctl_command="@PREFIX@/bin/synctl"
+conf_file="@PKG_SYSCONFDIR@/matrix-synapse/homeserver.yaml"
+required_files="$conf_file"
+pidfile="@SYNAPSE_DATA@/homeserver.pid"
+#start_precmd="ulimit -n 2048"
+: ${synapse_user:=@SYNAPSE_USER@}
+
+start_cmd="@SU@ -m ${synapse_user} -c '${ctl_command} start $conf_file'"
+stop_cmd="'@SU@ -m ${synapse_user} -c '${ctl_command} stop $conf_file'"
+
+load_rc_config $name
+run_rc_command "$1"
Home |
Main Index |
Thread Index |
Old Index