aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatcom8862020-07-28 20:07:08 +0200
committersatcom8862020-07-28 20:07:08 +0200
commitb61768fee2e4f05a2608af84a0a15181224f3cc0 (patch)
tree5b9eed6eb6beb96c06db528757b36976546661b7
downloadaur-b61768fee2e4f05a2608af84a0a15181224f3cc0.tar.gz
Initial commit
-rw-r--r--.SRCINFO46
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD79
-rw-r--r--README30
-rw-r--r--maubot-db-upgrade16
-rw-r--r--maubot.service15
-rw-r--r--sysusers-maubot.conf1
-rw-r--r--tmpfiles-maubot.conf1
-rw-r--r--usr-share.patch15
9 files changed, 205 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..7945181f4c98
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,46 @@
+pkgbase = maubot-git
+ pkgdesc = A plugin-based Matrix bot system
+ pkgver = r395.bc166e7
+ pkgrel = 1
+ url = https://github.com/maubot/maubot
+ arch = any
+ license = AGPLv3
+ makedepends = git
+ depends = python
+ depends = python-mautrix
+ depends = python-aiohttp
+ depends = python-sqlalchemy
+ depends = python-alembic
+ depends = python-commonmark
+ depends = python-ruamel-yaml
+ depends = python-attrs
+ depends = python-bcrypt
+ depends = python-packaging
+ depends = python-click
+ depends = python-colorama
+ depends = python-pyinquirer
+ depends = python-jinja
+ depends = sudo
+ optdepends = python-psycopg2: PostgreSQL database support
+ optdepends = python-asyncpg: e2be
+ optdepends = python-olm: e2be
+ optdepends = python-pycryptodome: e2be
+ optdepends = python-unpaddedbase64: e2be
+ conflicts = maubot
+ source = maubot::git+https://github.com/maubot/maubot
+ source = usr-share.patch
+ source = README
+ source = maubot-db-upgrade
+ source = sysusers-maubot.conf
+ source = tmpfiles-maubot.conf
+ source = maubot.service
+ sha256sums = SKIP
+ sha256sums = 8b3efe8076219b3b32381c81712019b13eb143b0358b9635cb5eb5f1d4f771f0
+ sha256sums = 41058411d46124a56dc9063d8604530095766f3eefc21cbd5b0bca1858103e29
+ sha256sums = f3849f10b32aea2819946524b423e55c392dd7efafe29f937b751f8e2a3056a3
+ sha256sums = e2f01fd60338dd576bb72dee2f536210cb54540ace4a40aa94b5aebe6944ba0f
+ sha256sums = b29dfcccd4012c117918e9210f01e7c28aa9b7e05c592811a71af0a4ba255770
+ sha256sums = c9a5e4b4cbe9ea6cc5957ab7352e247daefa53cb90d340083553ea7170f72ee4
+
+pkgname = maubot-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..256626ceb530
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+src
+pkg \ No newline at end of file
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..06bfc88429e6
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,79 @@
+# Maintainer: satcom886
+# PKGBUILD based on bobpaul's mautrix-facebook-git package
+_pkgbase=maubot
+pkgname=${_pkgbase}-git
+pkgver=r395.bc166e7
+pkgrel=1
+pkgdesc="A plugin-based Matrix bot system"
+arch=(any)
+conflicts=(maubot)
+license=(AGPLv3)
+url="https://github.com/maubot/maubot"
+depends=(
+ python
+ python-mautrix
+ python-aiohttp
+ python-sqlalchemy
+ python-alembic
+ python-commonmark
+ python-ruamel-yaml
+ python-attrs
+ python-bcrypt
+ python-packaging
+ python-click
+ python-colorama
+ python-pyinquirer
+ python-jinja
+ sudo
+)
+makedepends=(git)
+optdepends=(
+ "python-psycopg2: PostgreSQL database support"
+ "python-asyncpg: e2be"
+ "python-olm: e2be"
+ "python-pycryptodome: e2be"
+ "python-unpaddedbase64: e2be"
+)
+source=("${_pkgbase}::git+https://github.com/maubot/${_pkgbase}"
+ "usr-share.patch"
+ "README"
+ "maubot-db-upgrade"
+ "sysusers-maubot.conf"
+ "tmpfiles-maubot.conf"
+ "${_pkgbase}.service")
+sha256sums=('SKIP'
+ '8b3efe8076219b3b32381c81712019b13eb143b0358b9635cb5eb5f1d4f771f0'
+ '41058411d46124a56dc9063d8604530095766f3eefc21cbd5b0bca1858103e29'
+ 'f3849f10b32aea2819946524b423e55c392dd7efafe29f937b751f8e2a3056a3'
+ 'e2f01fd60338dd576bb72dee2f536210cb54540ace4a40aa94b5aebe6944ba0f'
+ 'b29dfcccd4012c117918e9210f01e7c28aa9b7e05c592811a71af0a4ba255770'
+ 'c9a5e4b4cbe9ea6cc5957ab7352e247daefa53cb90d340083553ea7170f72ee4')
+
+pkgver() {
+ cd "$srcdir/${_pkgbase}"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ cd "$srcdir/${_pkgbase}"
+ git reset --hard
+ echo 'Apply patch to follow fileplacement guidelines per `man heir`'
+ patch < ../usr-share.patch
+ echo 'Applying patch to permit use of newest mautrix version'
+ sed -i 's/^mautrix==/mautrix>=/' requirements.txt
+ # I don't think we need ^^^^ this
+ # (actually we need that...)
+}
+
+package() {
+ cd "$srcdir/${_pkgbase}"
+ python setup.py install --root="$pkgdir/" --optimize=1
+ install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ cd "$srcdir/"
+ install -Dm644 "$srcdir"/README -t "$pkgdir"/etc/synapse/mautrix-facebook/
+ install -Dm755 "$srcdir"/maubot-db-upgrade -t "$pkgdir"/usr/bin/
+ install -Dm644 ${_pkgbase}.service -t "${pkgdir}"/usr/lib/systemd/system/
+ install -Dm644 "$srcdir"/sysusers-maubot.conf "$pkgdir"/usr/lib/sysusers.d/maubot.conf
+ install -Dm644 "$srcdir"/tmpfiles-maubot.conf "$pkgdir"/usr/lib/tmpfiles.d/maubot.conf
+}
diff --git a/README b/README
new file mode 100644
index 000000000000..c0d53882f2f0
--- /dev/null
+++ b/README
@@ -0,0 +1,30 @@
+The systemd service maubot.service expects config and registration files here.
+
+Quick Setup:
+ ( adapted from https://github.com/tulir/maubot/wiki/Bridge-setup )
+
+1. Copy example config and ensure service can read it
+ sudo cp /usr/share/maubot/example-config.yaml /etc/synapse/maubot/config.yaml
+ sudo chown maubot /etc/synapse/maubot/config.yaml
+
+2. Update the config to your liking. You'll at least need to change the
+ homeserver settings. You also need to add your homeserver in the permissions
+ section and the auth server.
+
+3. Generate the registration:
+ sudo maubot -g -c /etc/synapse/maubot/config.yaml \
+ -r /etc/synapse/maubot/registration.yaml
+
+4. Add the registration file to Synapse's homeserver.yaml:
+ #homeserver.yaml
+ app_service_config_files:
+ - /etc/synapse/maubot/registration.yaml
+
+5. Restart synapse
+ sudo systemctl restart synapse
+
+6. Create/update the database:
+ sudo maubot-db-upgrade
+
+7. Start the bridge:
+ sudo systemctl start maubot
diff --git a/maubot-db-upgrade b/maubot-db-upgrade
new file mode 100644
index 000000000000..21f647b3cd04
--- /dev/null
+++ b/maubot-db-upgrade
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root"
+ exit 1
+fi
+
+cd /var/lib/maubot
+
+if [[ ! -e /var/lib/maubot/alembic ]]; then
+ ln -s /usr/share/maubot/alembic ./
+fi
+if [[ ! -e /var/lib/maubot/alembic.ini ]]; then
+ ln -s /usr/share/maubot/alembic.ini ./
+fi
+sudo -u maubot alembic -x config=/etc/synapse/maubot/config.yaml upgrade head
diff --git a/maubot.service b/maubot.service
new file mode 100644
index 000000000000..5f927f85be43
--- /dev/null
+++ b/maubot.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=facebook Matrix Puppet
+
+[Service]
+Type=simple
+User=mautrix-facebook
+Group=mautrix-facebook
+WorkingDirectory=/var/lib/mautrix-facebook/
+ExecStart=/usr/bin/mautrix-facebook -c /etc/synapse/mautrix-facebook/config.yaml \
+ -r /etc/synapse/mautrix-facebook/registration.yaml
+Restart=always
+RestartSec=3
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sysusers-maubot.conf b/sysusers-maubot.conf
new file mode 100644
index 000000000000..719711cebccb
--- /dev/null
+++ b/sysusers-maubot.conf
@@ -0,0 +1 @@
+u maubot 199 "Maubot user" /var/lib/maubot
diff --git a/tmpfiles-maubot.conf b/tmpfiles-maubot.conf
new file mode 100644
index 000000000000..78ed9582931f
--- /dev/null
+++ b/tmpfiles-maubot.conf
@@ -0,0 +1 @@
+d /var/lib/maubot 0700 maubot maubot -
diff --git a/usr-share.patch b/usr-share.patch
new file mode 100644
index 000000000000..b2b2c8641e64
--- /dev/null
+++ b/usr-share.patch
@@ -0,0 +1,15 @@
+--- a/setup.py 2020-07-28 19:57:24.137669114 +0200
++++ b/setup.py 2020-07-28 20:03:37.138596078 +0200
+@@ -57,9 +57,9 @@
+ mbc=maubot.cli:app
+ """,
+ data_files=[
+- (".", ["example-config.yaml", "alembic.ini"]),
+- ("alembic", ["alembic/env.py"]),
+- ("alembic/versions", glob.glob("alembic/versions/*.py")),
++ ("./share/maubot", ["example-config.yaml", "alembic.ini"]),
++ ("./share/maubot/alembic", ["alembic/env.py"]),
++ ("./share/maubot/alembic/versions", glob.glob("alembic/versions/*.py"))
+ ],
+ package_data={
+ "maubot": ["management/frontend/build/*", "management/frontend/build/static/css/*",