testing/mautrix-gvoice: new aport

https://docs.mau.fi/bridges/go/gvoice/
Matrix-Google Voice puppeting bridge
This commit is contained in:
fossdd 2024-09-11 16:50:22 +02:00 committed by Patrycja Rosa
parent b6abdc4f3f
commit d4c55e9141
4 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,71 @@
# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=mautrix-gvoice
_commit=75f3b0da2b0755773424fa1dab8c125ef70f12ca
pkgver=0_git20240902
pkgrel=0
pkgdesc="Matrix-Google Voice puppeting bridge"
url="https://docs.mau.fi/bridges/go/gvoice/"
arch="all"
license="AGPL-3.0-or-later"
makedepends="
go
olm-dev
sqlite-dev
"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc $pkgname-doc"
source="$pkgname-$_commit.tar.gz::https://github.com/mautrix/gvoice/archive/$_commit.tar.gz
mautrix-gvoice.initd
mautrix-gvoice.confd
"
builddir="$srcdir/gvoice-$_commit"
options="net"
export GOFLAGS="$GOFLAGS -tags=libsqlite3"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
case "$CARCH" in
armhf|armv7|x86)
options="$options !check";; # https://github.com/mautrix/gvoice/issues/2
esac
build() {
export CGO_CFLAGS="$CFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
go build \
-ldflags "-X main.Tag=$pkgver -X 'main.BuildTime=$(date -d @"$SOURCE_DATE_EPOCH" '+%b %_d %Y, %H:%M:%S')'" \
./cmd/mautrix-gvoice
./mautrix-gvoice -e
sed -i 's|./logs/bridge.log|/var/log/mautrix-gvoice/mautrix-gvoice.log|g' config.yaml
}
check() {
go test -v ./...
}
package() {
install -Dm755 mautrix-gvoice \
-t "$pkgdir"/usr/bin/
install -Dm644 config.yaml \
-t "$pkgdir"/etc/mautrix-gvoice/
install -Dm755 "$srcdir"/mautrix-gvoice.initd \
"$pkgdir"/etc/init.d/mautrix-gvoice
install -Dm644 "$srcdir"/mautrix-gvoice.confd \
"$pkgdir"/etc/conf.d/mautrix-gvoice
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
sha512sums="
0a83531186b9875f74f6c7ff4dce055cf1f012a95b90acece70945762a15c384bf23131200ee7683e0e41726c7cdae1168a727dec75965407955a7f02cd428c5 mautrix-gvoice-75f3b0da2b0755773424fa1dab8c125ef70f12ca.tar.gz
23bb2c8d81d944fae147880555a793a8ee5091027abef058efaeb33cecedf43fe3b68f164aa4d27eaafdeaccc23c6f853966c6570287276d71e45128c91814e6 mautrix-gvoice.initd
2a0ed15f3dfa6b79de5e0ec42dc28efbb828c5cd3234aadc8db5544c5046513d82a2627ba66d97426ceb97037e7b0039039ccbf7000f8e135942671b5764f3a7 mautrix-gvoice.confd
"

View File

@ -0,0 +1,7 @@
# Configuration for /etc/init.d/mautrix-gvoice
# Location of configuration file
config="/etc/mautrix-gvoice/config.yaml"
# Extra arguments to be passed when starting mautrix-gvoice
# command_args=""

View File

@ -0,0 +1,20 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
name="mautrix-gvoice"
description="Daemon for mautrix-gvoice, a Matrix-Google Voice puppeting bridge"
: ${config:="/etc/mautrix-gvoice/config.yaml"}
: ${command_user:="mautrix-gvoice:mautrix-gvoice"}
command="/usr/bin/mautrix-gvoice"
command_args="-c $config $command_args"
depend() {
need net
}
start_pre() {
checkpath --file --owner "$command_user" "$config"
checkpath --directory --owner "$command_user" /var/log/mautrix-gvoice
}

View File

@ -0,0 +1,6 @@
#!/bin/sh
addgroup -S mautrix-gvoice 2>/dev/null
adduser -S -D -H -h /var/lib/mautrix-gvoice -s /sbin/nologin -G mautrix-gvoice -g mautrix-gvoice mautrix-gvoice 2>/dev/null
exit 0