diff --git a/testing/mautrix-gvoice/APKBUILD b/testing/mautrix-gvoice/APKBUILD new file mode 100644 index 00000000000..424b098bdde --- /dev/null +++ b/testing/mautrix-gvoice/APKBUILD @@ -0,0 +1,71 @@ +# Contributor: fossdd +# Maintainer: fossdd +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 +" diff --git a/testing/mautrix-gvoice/mautrix-gvoice.confd b/testing/mautrix-gvoice/mautrix-gvoice.confd new file mode 100644 index 00000000000..78d12a1fa21 --- /dev/null +++ b/testing/mautrix-gvoice/mautrix-gvoice.confd @@ -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="" diff --git a/testing/mautrix-gvoice/mautrix-gvoice.initd b/testing/mautrix-gvoice/mautrix-gvoice.initd new file mode 100644 index 00000000000..6e9f248b7d3 --- /dev/null +++ b/testing/mautrix-gvoice/mautrix-gvoice.initd @@ -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 +} diff --git a/testing/mautrix-gvoice/mautrix-gvoice.pre-install b/testing/mautrix-gvoice/mautrix-gvoice.pre-install new file mode 100644 index 00000000000..80ee74654cf --- /dev/null +++ b/testing/mautrix-gvoice/mautrix-gvoice.pre-install @@ -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