diff --git a/net-im/mjolnir/Manifest b/net-im/mjolnir/Manifest new file mode 100644 index 0000000..80c2152 --- /dev/null +++ b/net-im/mjolnir/Manifest @@ -0,0 +1,2 @@ +DIST mjolnir-1.5.0-deps.tar.xz 34428920 BLAKE2B b1876ea496c9ad4815a86ba6e5f9474cf76a9dd05e678fbc5c74a617920050604995abb41bdfe09590f3deb07605018be5c78a463ae7982613945021e2bd0b9c SHA512 676b6580e632e7bd2a96fe55d8887713a576a232777010421a3d6f675b5584a476736145530a6169281484e7e80fc7c66b35a0bf1a1521978ba76a18c15c8770 +DIST mjolnir-1.5.0.tar.gz 194488 BLAKE2B e1b2a9335815b8a2f4452e3be1b27a903e9b96b565cbd567d5b4d52cb1e2ab914fd3be963abc6857e775343af79a4708320f6496f4242bcac9ed1898588fcdf4 SHA512 2f0d00e7c4e1cee8cdcc2565821638c3a979538402ccafd10beb0fd8edcd2cbf0e46f5bf11a6df2c02dfff49b89cbf731d9bcd5411b805d9079cdcac5484c06d diff --git a/net-im/mjolnir/files/mjolnir.initd b/net-im/mjolnir/files/mjolnir.initd new file mode 100644 index 0000000..fd76484 --- /dev/null +++ b/net-im/mjolnir/files/mjolnir.initd @@ -0,0 +1,23 @@ +#!/sbin/openrc-run +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +name="mjolnir daemon" +description="mjolnir daemon" +command=/usr/bin/node +command_args="mjolnir/index.js" +command_user="${MJOLNIR_USER:-synapse}" + +supervisor="supervise-daemon" +supervise_daemon_args=" -d /opt/mjolnir -e NODE_ENV=\"production\"" + +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + need net +} + +start_pre() { + local cfg=/opt/mjolnir/config/production.yaml + [[ -f ${cfg} ]] || echo "${cfg} does not exist or is not a regular file" >&2 +} diff --git a/net-im/mjolnir/metadata.xml b/net-im/mjolnir/metadata.xml new file mode 100644 index 0000000..244899b --- /dev/null +++ b/net-im/mjolnir/metadata.xml @@ -0,0 +1,11 @@ + + + + + gentoo@tastytea.de + Ronny (tastytea) Gutbrod + + + matrix-org/mjolnir + + diff --git a/net-im/mjolnir/mjolnir-1.5.0.ebuild b/net-im/mjolnir/mjolnir-1.5.0.ebuild new file mode 100644 index 0000000..85fa960 --- /dev/null +++ b/net-im/mjolnir/mjolnir-1.5.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="A moderation tool for Matrix" +HOMEPAGE="https://github.com/matrix-org/mjolnir" +SRC_URI=" + https://github.com/matrix-org/mjolnir/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + https://tastytea.de/files/gentoo/${P}-deps.tar.xz +" + +# NOTE: to generate the deps archive: +# yarn --cache-folder ./yarn-cache install +# tar -caf ${P}-deps.tar.xz yarn-cache + +LICENSE="0BSD Apache-2.0 BSD BSD-2 ISC MIT PYTHON Unlicense" +SLOT="0" +# KEYWORDS="~amd64" +IUSE="doc" + +RDEPEND=">=net-libs/nodejs-16" +BDEPEND="sys-apps/yarn" + +MY_YARNOPTS="--offline --non-interactive --no-progress --verbose" + +src_prepare() { + yarn ${MY_YARNOPTS} --cache-folder ../yarn-cache install || die + + default +} + +src_compile() { + yarn ${MY_YARNOPTS} build || die +} + +src_install() { + insinto /opt/${PN} + doins -r node_modules + + insinto /opt/${PN}/${PN} + doins -r lib/* + + keepdir /opt/${PN}/config + + einstalldocs + dodoc config/default.yaml + use doc && dodoc docs/* + + newinitd "${FILESDIR}"/${PN}.initd ${PN} +} + +pkg_postinstall() { + if [[ ! -f "${EROOT}"/opt/${PN}/config/production.yaml ]]; then + elog "Copy the configuration example from /usr/share/doc/${PF}/default.yaml*" + elog "into /opt/${PN}/config/production.yaml and edit it." + fi +}