summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrainDamage2023-09-12 20:06:39 +0200
committerBrainDamage2023-09-12 20:06:39 +0200
commitc3b71ba093fde59e42b6b80438bc5e42563655c7 (patch)
tree7208942c85dfcbc6322c294083ffc986e05af39b
downloadaur-c3b71ba093fde59e42b6b80438bc5e42563655c7.tar.gz
initial version
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD47
-rw-r--r--mautrix-discord.service39
-rw-r--r--mautrix-discord.sysusers1
-rw-r--r--mautrix-discord.tmpfiles3
5 files changed, 111 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..271e7ee47abe
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = mautrix-discord
+ pkgdesc = A Matrix-Discord puppeting bridge based on discordgo
+ pkgver = 0.6.1
+ pkgrel = 1
+ url = https://github.com/mautrix/discord
+ arch = x86_64
+ arch = aarch64
+ license = GPL3
+ makedepends = go
+ depends = libolm
+ backup = etc/mautrix-discord/config.yaml
+ source = mautrix-discord-0.6.1::https://github.com/mautrix/discord/archive/v0.6.1.tar.gz
+ source = mautrix-discord.service
+ source = mautrix-discord.sysusers
+ source = mautrix-discord.tmpfiles
+ sha256sums = 55aacdff9d5eab1eec53c96a054f82aee0e38b0286e5f5472037df9760ee925c
+ sha256sums = 17e5414d8355b9c7a503d6e166abf41640c6247fb168de94850d1b67c6a0fa33
+ sha256sums = ebb8d96fd415ec2957a2eddda5fcfa32b9e889bcc7531ad4962afeadc5887852
+ sha256sums = 34d758c0a05da759107aaabc6dbcbe0acc3f3881391412f4f6f355b253641eb9
+
+pkgname = mautrix-discord
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..0f5635d84f73
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,47 @@
+# Maintainer: BrainDamage
+
+pkgname=mautrix-discord
+pkgver=0.6.1
+pkgrel=1
+pkgdesc="A Matrix-Discord puppeting bridge based on discordgo"
+arch=('x86_64' 'aarch64')
+license=('GPL3')
+makedepends=('go')
+depends=('libolm')
+url="https://github.com/mautrix/discord"
+source=("${pkgname}-${pkgver}::${url}/archive/v${pkgver}.tar.gz" "${pkgname}.service" "${pkgname}.sysusers" "${pkgname}.tmpfiles")
+sha256sums=('55aacdff9d5eab1eec53c96a054f82aee0e38b0286e5f5472037df9760ee925c'
+ '17e5414d8355b9c7a503d6e166abf41640c6247fb168de94850d1b67c6a0fa33'
+ 'ebb8d96fd415ec2957a2eddda5fcfa32b9e889bcc7531ad4962afeadc5887852'
+ '34d758c0a05da759107aaabc6dbcbe0acc3f3881391412f4f6f355b253641eb9')
+backup=("etc/${pkgname}/config.yaml")
+
+_dirname="${pkgname#mautrix-}-${pkgver}"
+
+build() {
+ cd "${srcdir}/${_dirname}"
+ go build \
+ -trimpath \
+ -buildmode=pie \
+ -mod=readonly \
+ -modcacherw \
+ -ldflags "-extldflags \"${LDFLAGS}\"" \
+ -o "${pkgname}" .
+}
+
+# template start; name=install_bin; version=1;
+package() {
+ cd "${srcdir}/${_dirname}"
+ find . -mindepth 1 -type f -iname "${pkgname}" -executable \
+ -exec install -Dvm 755 -t "${pkgdir}/usr/bin" {} +
+ find . -maxdepth 1 -iname 'README*' \
+ -exec install -Dvm 644 -t "${pkgdir}/usr/share/doc/${pkgname}" {} +
+ find . -maxdepth 1 -iname 'LICENSE*' \
+ -exec install -Dvm 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" {} +
+
+ install -Dvm 644 "${srcdir}/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+ install -Dvm 644 "${srcdir}/${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+ install -Dvm 644 "${srcdir}/${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
+
+ install -Dvm 640 example-config.yaml "${pkgdir}/etc/${pkgname}/config.yaml"
+}
diff --git a/mautrix-discord.service b/mautrix-discord.service
new file mode 100644
index 000000000000..43a7ba50131e
--- /dev/null
+++ b/mautrix-discord.service
@@ -0,0 +1,39 @@
+[Unit]
+Description=Matrix-Discord hybrid puppeting/relaybot bridge
+
+[Service]
+ExecStart=mautrix-discord -c /etc/mautrix-discord/config.yaml -r /etc/mautrix-discord/registration.yaml
+Restart=on-failure
+User=mautrix-discord
+WorkingDirectory=~
+
+StateDirectory=mautrix-discord
+ReadWritePaths=%S/mautrix-discord
+
+# minimum-ish set of operations to allow it to work on fs, network, ipc, etc
+SystemCallFilter=@system-service
+RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
+
+NoNewPrivileges=True
+LockPersonality=True
+RestrictNamespaces=True
+RemoveIPC=True
+RestrictSUIDSGID=True
+SystemCallArchitectures=native
+MemoryDenyWriteExecute=True
+
+PrivateTmp=True
+PrivateMounts=True
+ProtectSystem=strict
+ProtectControlGroups=True
+ProtectKernelLogs=True
+ProtectKernelModules=True
+ProtectKernelTunables=True
+ProtectHome=True
+ProtectProc=invisible
+ProtectHostname=True
+ProtectClock=True
+RestrictRealtime=True
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mautrix-discord.sysusers b/mautrix-discord.sysusers
new file mode 100644
index 000000000000..9c3d8ea79681
--- /dev/null
+++ b/mautrix-discord.sysusers
@@ -0,0 +1 @@
+u mautrix-discord - "Matrix Discord puppeting bridge" /var/lib/mautrix-discord
diff --git a/mautrix-discord.tmpfiles b/mautrix-discord.tmpfiles
new file mode 100644
index 000000000000..bf3f78ab72c2
--- /dev/null
+++ b/mautrix-discord.tmpfiles
@@ -0,0 +1,3 @@
+z /etc/mautrix-discord/ 770 mautrix-discord mautrix-discord
+z /etc/mautrix-discord/* 640 mautrix-discord mautrix-discord
+d /var/lib/mautrix-discord/ 700 mautrix-discord mautrix-discord