aboutsummaryrefslogtreecommitdiffstats
path: root/testing/matrix-appservice-irc
diff options
context:
space:
mode:
Diffstat (limited to 'testing/matrix-appservice-irc')
-rw-r--r--testing/matrix-appservice-irc/APKBUILD55
-rw-r--r--testing/matrix-appservice-irc/matrix-appservice-irc.confd11
-rw-r--r--testing/matrix-appservice-irc/matrix-appservice-irc.initd32
3 files changed, 98 insertions, 0 deletions
diff --git a/testing/matrix-appservice-irc/APKBUILD b/testing/matrix-appservice-irc/APKBUILD
new file mode 100644
index 0000000000..c163977992
--- /dev/null
+++ b/testing/matrix-appservice-irc/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Rasmus Thomsen <oss@cogitri.dev>
+# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
+pkgname=matrix-appservice-irc
+pkgver=0.13.1
+pkgrel=0
+pkgdesc="Node.js IRC bridge for Matrix"
+url="https://github.com/matrix-org/matrix-appservice-irc"
+arch="all !s390x" # fails on CI
+license="Apache-2.0"
+depends="nodejs"
+makedepends="npm python3"
+subpackages="$pkgname-openrc"
+source="https://github.com/matrix-org/matrix-appservice-irc/archive/$pkgver/matrix-appservice-irc-$pkgver.tar.gz
+ matrix-appservice-irc.initd
+ matrix-appservice-irc.confd"
+
+case "$CARCH" in
+ x86)
+ options="textrels"
+ ;;
+esac
+
+build() {
+ npm install
+}
+
+check() {
+ npm test
+}
+
+package() {
+ mkdir -p "$pkgdir"/etc/matrix-appservice-irc
+ mkdir -p "$pkgdir"/usr/bin
+ mkdir -p "$pkgdir"/usr/share/webapps/matrix-appservice-irc
+
+ cp config.sample.yaml "$pkgdir"/etc/matrix-appservice-irc
+
+ cp -r \
+ "$builddir"/bin \
+ "$builddir"/node_modules \
+ "$builddir"/app.js \
+ "$builddir"/lib \
+ "$builddir"/scripts \
+ "$pkgdir"/usr/share/webapps/matrix-appservice-irc
+
+ ln -s /usr/share/webapps/matrix-appservice-irc/bin/matrix-appservice-irc \
+ "$pkgdir"/usr/bin/matrix-appservice-irc
+
+ install -Dm755 "$srcdir"/matrix-appservice-irc.initd "$pkgdir"/etc/init.d/matrix-appservice-irc
+ install -Dm644 "$srcdir"/matrix-appservice-irc.confd "$pkgdir"/etc/conf.d/matrix-appservice-irc
+}
+
+sha512sums="a84cddbd962425d72f8edef6c9c6578f7d3ae386f20eac785721e99cb09f9d7dc15f2bec68b8210bee76a0b93ead3cbdd235a1fba513b1c1a6fdedd238df38b1 matrix-appservice-irc-0.13.1.tar.gz
+c1cd9ebbf25c464159a05c369b3ff408e24aeb8beb8c06f336fb14b97ff15f9579b68c10f253f9cd207a117152510a4a49538064676bb2d1008434f985ef1c28 matrix-appservice-irc.initd
+7b9e320a44cd07bb2876704eb1fa33dc0a8a6e237badf1e3d026d347df113eab144b42a0ad0e42b8f6e598c435e26982b37ef2ecdbd663fe34f34757e2e279cf matrix-appservice-irc.confd"
diff --git a/testing/matrix-appservice-irc/matrix-appservice-irc.confd b/testing/matrix-appservice-irc/matrix-appservice-irc.confd
new file mode 100644
index 0000000000..53560feb1b
--- /dev/null
+++ b/testing/matrix-appservice-irc/matrix-appservice-irc.confd
@@ -0,0 +1,11 @@
+# Configuration for /etc/init.d/matrix-appservice-irc
+
+# Location of configuration file
+config="/etc/matrix-appservice-irc/config.yaml"
+
+# Location of the registration file
+registration_file="/etc/synapse/matrix-appservice-irc-registration.yaml"
+
+# Port to run the service on
+port=9999
+
diff --git a/testing/matrix-appservice-irc/matrix-appservice-irc.initd b/testing/matrix-appservice-irc/matrix-appservice-irc.initd
new file mode 100644
index 0000000000..2c80daad6b
--- /dev/null
+++ b/testing/matrix-appservice-irc/matrix-appservice-irc.initd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name="matrix-appservice-irc"
+description="Daemon for matrix-appservice-irc, a Node.js IRC bridge for Matrix"
+
+: ${command_user:="synapse:synapse"}
+: ${config:="/etc/matrix-appservice-irc/config.yaml"}
+: ${registration_file:="/etc/synapse/matrix-appservice-irc-registration.yaml"}
+: ${port:=9999}
+
+command="/usr/bin/matrix-appservice-irc"
+command_args="-c $config -f $registration_file -p $port"
+supervise_daemon_args="--chdir /var/lib/matrix-appservice-irc --stdout /var/log/matrix-appservice-irc.log --stderr /var/log/matrix-appservice-irc.log"
+
+depends() {
+ use logger
+ need net
+}
+
+start_pre() {
+ checkpath --owner $command_user --file /var/log/matrix-appservice-irc.log
+ if [ ! -f $config ]; then
+ eerror "Couldn't find config file!"
+ return 1
+ fi
+ if [ ! -f $registration_file ]; then
+ eerror "Couldn't find registration file!
+ See https://github.com/matrix-org/matrix-appservice-irc#3-registration for how to generate one."
+ return 1
+ fi
+}