net-im/mautrix-whatsapp: New package.

main
Jesús P Rey (Chuso) 2024-03-11 21:45:57 +01:00
parent 75d0c7a487
commit 4faf5aa6ae
No known key found for this signature in database
GPG Key ID: 0E663E0721D67C24
5 changed files with 121 additions and 0 deletions

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -0,0 +1,60 @@
# Copyright 2022-2024 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"
}

View File

@ -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>