diff options
Diffstat (limited to 'net-im')
-rw-r--r-- | net-im/mautrix-whatsapp/Manifest | 2 | ||||
-rw-r--r-- | net-im/mautrix-whatsapp/files/mautrix-whatsapp.initd | 25 | ||||
-rw-r--r-- | net-im/mautrix-whatsapp/files/mautrix-whatsapp.service | 12 | ||||
-rw-r--r-- | net-im/mautrix-whatsapp/mautrix-whatsapp-0.10.0.ebuild | 60 | ||||
-rw-r--r-- | net-im/mautrix-whatsapp/metadata.xml | 22 |
5 files changed, 121 insertions, 0 deletions
diff --git a/net-im/mautrix-whatsapp/Manifest b/net-im/mautrix-whatsapp/Manifest new file mode 100644 index 000000000..23a567620 --- /dev/null +++ b/net-im/mautrix-whatsapp/Manifest @@ -0,0 +1,2 @@ +DIST mautrix-whatsapp-0.10.0-deps.tar.xz 44605336 BLAKE2B 631844436ca1fb408a1dbd074d613f5b21c789bc7af931336204c4c104a0e7f039ddddc7c94c651211e12253bcf63b72a899f4b2bb554eed6f778a1e747dd762 SHA512 fb06e5d121c2e1d2ed67ca21973a37187d0f79d5cc1206bc8aa7a031503967932254e430db00ee95645770eea7509f0ec9ab24fa3fe6a26bb5fb28149873a584 +DIST mautrix-whatsapp-0.10.0.gh.tar.gz 152560 BLAKE2B b455c54fec79c0d56b61d441291a3f5ae1ab55db3f23e69d2fd5c11cc0bcbd69d5d8f14cd44c6a252d1f72c37af0d67ac959cc3a9163fe772d3d530d4f5f2af0 SHA512 0906b1e01f26d25adf337a012e73fa28bf9961a30add61ae7a22aaf903ce28d50e00c34124ed6703c9be86a38c3e29d638c2fa969013608ee38034cc01b5882f diff --git a/net-im/mautrix-whatsapp/files/mautrix-whatsapp.initd b/net-im/mautrix-whatsapp/files/mautrix-whatsapp.initd new file mode 100644 index 000000000..f06e9948f --- /dev/null +++ b/net-im/mautrix-whatsapp/files/mautrix-whatsapp.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +name="mautrix-whatsapp daemon" +description="A Matrix-WhatsApp puppeting bridge" +module="mautrix_whatsapp" + +pidfile="/run/${RC_SVCNAME}.pid" +command="/usr/bin/mautrix-whatsapp" +command_args="-c /etc/mautrix/${module}.yaml -r /var/lib/mautrix/whatsapp/registration.yaml" +command_background=true +command_user="mautrix-whatsapp:mautrix" + +output_log="/var/log/mautrix/mautrix-whatsapp_daemon.log" +error_log="/var/log/mautrix/mautrix-whatsapp_daemon.log" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0755 -o "$command_user" /var/lib/mautrix/whatsapp + checkpath -f -m 0644 -o "$command_user" "$output_log" +} diff --git a/net-im/mautrix-whatsapp/files/mautrix-whatsapp.service b/net-im/mautrix-whatsapp/files/mautrix-whatsapp.service new file mode 100644 index 000000000..8e5541208 --- /dev/null +++ b/net-im/mautrix-whatsapp/files/mautrix-whatsapp.service @@ -0,0 +1,12 @@ +[Unit] +Description=A Matrix-WhatsApp puppeting bridge +After=network.target + +[Service] +User=mautrix-whatsapp +Group=mautrix +Restart=on-failure +ExecStart=/usr/bin/mautrix-whatsapp -c /etc/mautrix/mautrix_whatsapp.yaml -r /var/lib/mautrix/whatsapp/registration.yaml + +[Install] +WantedBy=multi-user.target diff --git a/net-im/mautrix-whatsapp/mautrix-whatsapp-0.10.0.ebuild b/net-im/mautrix-whatsapp/mautrix-whatsapp-0.10.0.ebuild new file mode 100644 index 000000000..7dd38106f --- /dev/null +++ b/net-im/mautrix-whatsapp/mautrix-whatsapp-0.10.0.ebuild @@ -0,0 +1,60 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module optfeature systemd + +DESCRIPTION="A Matrix-WhatsApp puppeting bridge " +HOMEPAGE="https://github.com/mautrix/whatsapp/" +SRC_URI="https://github.com/mautrix/whatsapp/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz + https://distfiles.chuso.net/distfiles/${P}-deps.tar.xz" +S="${WORKDIR}/whatsapp-${PV}" + +LICENSE="AGPL-3 GPL-3" +SLOT="0" +KEYWORDS="~amd64" +IUSE="crypt" + +DEPEND="crypt? ( dev-libs/olm )" + +RDEPEND="acct-user/${PN}" + +src_compile() { + ego build $(use crypt || echo '-tags nocrypto') +} + +src_install() { + dobin "${PN}" + + keepdir /var/log/mautrix/${PN/mautrix-/} + fowners -R root:mautrix /var/log/mautrix + fperms -R 770 /var/log/mautrix + sed -i -e "s_\./logs_/var/log/mautrix_" "example-config.yaml" || die + + insinto "/etc/mautrix" + newins "example-config.yaml" "${PN/-/_}.yaml" + + newinitd "${FILESDIR}/${PN}.initd" "${PN}" + systemd_dounit "${FILESDIR}/${PN}.service" + + fowners -R root:mautrix /etc/mautrix + fperms -R 770 /etc/mautrix +} + +pkg_postinst() { + optfeature "sending GIFs" media-video/ffmpeg + + elog "Before you can use ${PN}, you must configure it correctly" + elog "The configuration file is located at \"/etc/mautrix/${PN/-/_}.yaml\"" + elog "When done, run the following command: emerge --config ${CATEGORY}/${PN}" + elog "Then, you must register the bridge with your homeserver" + elog "Refer 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" +} + +pkg_config() { + su - "${PN}" -s /bin/sh -c \ + "/usr/bin/${PN} -c /etc/mautrix/${PN/-/_}.yaml -g -r /var/lib/${PN/-/\/}/registration.yaml" +} diff --git a/net-im/mautrix-whatsapp/metadata.xml b/net-im/mautrix-whatsapp/metadata.xml new file mode 100644 index 000000000..fc68fa52f --- /dev/null +++ b/net-im/mautrix-whatsapp/metadata.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>gentoo@chuso.net</email> + <name>Jesus Perez Rey</name> + </maintainer> + <use> + <flag name="crypt">Enable end-to-bridge encryption with <pkg>dev-libs/olm</pkg>.</flag> + </use> + <upstream> + <maintainer> + <name>Tulir Asokan</name> + <email>tulir@maunium.net</email> + </maintainer> + <changelog>https://github.com/mautrix/whatsapp/releases</changelog> + <doc>https://docs.mau.fi/bridges/go/whatsapp/index.html</doc> + <bugs-to>https://github.com/mautrix/whatsapp/issues</bugs-to> + <remote-id type="github">mautrix/whatsapp</remote-id> + <remote-id type="pypi">mautrix-whatsapp</remote-id> + </upstream> +</pkgmetadata> |