commit:     0cce4c013526e1d97c342c5ba0eddb34cf4aeac9
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Sun Apr 20 08:41:42 2025 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Mon Apr 21 09:02:33 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0cce4c01

net-im/heisenbridge: update OpenRC service

* Use supervise-daemon instead of s-s-d

* Log to syslog

* Allow to pass additional command-line options

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 net-im/heisenbridge/files/heisenbridge.confd-r1   | 24 +++++++++
 net-im/heisenbridge/files/heisenbridge.initd-r1   | 30 +++++++++++
 net-im/heisenbridge/heisenbridge-1.15.2-r1.ebuild | 66 +++++++++++++++++++++++
 3 files changed, 120 insertions(+)

diff --git a/net-im/heisenbridge/files/heisenbridge.confd-r1 
b/net-im/heisenbridge/files/heisenbridge.confd-r1
new file mode 100644
index 000000000..6ae57edc1
--- /dev/null
+++ b/net-im/heisenbridge/files/heisenbridge.confd-r1
@@ -0,0 +1,24 @@
+# Homeserver
+# Must be set
+HOMESERVER="https://example.com";
+
+# Path to the registration file
+# Default: /var/lib/heisenbridge/registration.yaml
+#REGISTRATION="/var/lib/heisenbridge/registration.yaml"
+
+# Listen address
+# Default: 127.0.0.1
+#LISTEN_ADDRESS="127.0.0.1"
+
+# Listen port
+# Default: 9898
+#LISTEN_PORT=9898
+
+# Owner
+# Generally should be the admin of the home server
+# For example: @user:home.server
+# Default: not set
+#OWNER="@user:example.com"
+
+# Additional command-line options for Heisenbridge
+#HEISENBRIDGE_OPTS=""

diff --git a/net-im/heisenbridge/files/heisenbridge.initd-r1 
b/net-im/heisenbridge/files/heisenbridge.initd-r1
new file mode 100644
index 000000000..f03a70fab
--- /dev/null
+++ b/net-im/heisenbridge/files/heisenbridge.initd-r1
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# shellcheck shell=sh
+
+description="Bouncer-style Matrix IRC bridge"
+
+supervisor="supervise-daemon"
+command="/usr/bin/python"
+command_args="-m heisenbridge \
+       -c ${REGISTRATION:-/var/lib/heisenbridge/registration.yaml} \
+       ${LISTEN_ADDRESS+-l ${LISTEN_ADDRESS}} \
+       ${LISTEN_PORT+-p ${LISTEN_PORT}} \
+       ${OWNER+-o ${OWNER}} \
+       -u heisenbridge -g heisenbridge \
+       ${HEISENBRIDGE_OPTS} ${HOMESERVER}"
+pidfile="/run/${RC_SVCNAME}.pid"
+
+output_logger="logger -p daemon.info -t heisenbridge --"
+error_logger="logger -p daemon.err -t heisenbridge --"
+
+depend() {
+       use dns logger
+       need net
+}
+
+start_pre() {
+       checkpath -d -m 0755 -o heisenbridge:heisenbridge /var/lib/heisenbridge
+}

diff --git a/net-im/heisenbridge/heisenbridge-1.15.2-r1.ebuild 
b/net-im/heisenbridge/heisenbridge-1.15.2-r1.ebuild
new file mode 100644
index 000000000..e873c6ace
--- /dev/null
+++ b/net-im/heisenbridge/heisenbridge-1.15.2-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{11..13} )
+inherit distutils-r1 systemd
+
+DESCRIPTION="Bouncer-style Matrix IRC bridge"
+HOMEPAGE="https://github.com/hifi/heisenbridge";
+SRC_URI="https://github.com/hifi/${PN}/archive/refs/tags/v${PV}.tar.gz -> 
${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+       acct-user/heisenbridge
+       <dev-python/aiohttp-4[${PYTHON_USEDEP}]
+       dev-python/async-timeout[${PYTHON_USEDEP}]
+       dev-python/irc[${PYTHON_USEDEP}]
+       >=dev-python/mautrix-0.20.5[${PYTHON_USEDEP}]
+       dev-python/python-socks[${PYTHON_USEDEP}]
+       dev-python/ruamel-yaml[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+       "${FILESDIR}/heisenbridge-1.14.1-qanotice.patch"
+)
+
+distutils_enable_tests pytest
+
+src_prepare() {
+       distutils-r1_src_prepare
+       echo ${PV} > ${PN}/version.txt || die
+}
+
+src_install() {
+       distutils-r1_src_install
+
+       newinitd "${FILESDIR}"/heisenbridge.initd-r1 ${PN}
+       newconfd "${FILESDIR}"/heisenbridge.confd-r1 ${PN}
+       systemd_dounit "${FILESDIR}"/${PN}.service
+}
+
+pkg_postinst() {
+       [[ -f "${EPREFIX}"/var/lib/${PN}/registration.yaml ]] && return 0
+
+       einfo
+       elog "Before you can use ${PN}, you have to configure it correctly."
+       elog "The configuration file is located at /etc/conf.d/${PN}"
+       elog
+       elog "Then, you must generate the registration file using the following 
command:"
+       elog "* If you are using Synapse:"
+       elog "\t${PN} -c /var/lib/${PN}/registration.yaml --generate 
https://example.com";
+       elog "* If you are using Dendrite, Conduit or others:"
+       elog "\t${PN} -c /var/lib/${PN}/registration.yaml --generate-compat 
https://example.com";
+       elog
+       elog "Notice the URL at the end, replace it with your homeserver's URL."
+       elog "Then, you must register the bridge with your homeserver."
+       elog "Refer to your homeserver's documentation for instructions."
+       elog "The registration file is located at 
/var/lib/${PN}/registration.yaml"
+       elog "Finally, you may start the ${PN} daemon."
+       einfo
+}

Reply via email to