summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorHLFH2022-10-28 13:17:47 +0100
committerHLFH2022-10-28 13:17:47 +0100
commit2a6b11020944be42c9327751bc221eed71866885 (patch)
tree0e7b34e5727a604f2be2231154808fd620d22f86
downloadaur-2a6b11020944be42c9327751bc221eed71866885.tar.gz
automua initial release
-rw-r--r--.SRCINFO19
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD34
-rw-r--r--automua.conf20
-rw-r--r--automua.service14
-rw-r--r--automua.sysusers1
-rw-r--r--automua.tmpfiles1
-rw-r--r--setupvenv.sh19
8 files changed, 112 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2212a4b317d2
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = automua
+ pkgdesc = Email client configuration made easy
+ pkgver = 2022.4
+ pkgrel = 1
+ arch = any
+ license = GPL3
+ backup = etc/automua/automua.conf
+ source = setupvenv.sh
+ source = automua.sysusers
+ source = automua.conf
+ source = automua.service
+ source = automua.tmpfiles
+ b2sums = 5baa7fb3b143306fc91187bdd430b9f59c5dd84452ed78321747195c441f9f996ecccd9af6d5ba13219d89308fc3c4865deee837438518eb8e1d85b64903c444
+ b2sums = 9f5f26ee77c39c9988c60fbfa6ea0e492a00769bc8e827da88d149e78d919f2eff1ac160ff5af82deddeea03581dc150278564bdcf7401e42c337f4977a2ff07
+ b2sums = 1ecda927911fe33f96c4a040593e190185b7c5450411c2b26ad4c35953c6d27813316bfff88fa3fcfd48c06fa1f2e4444f23a7ad8dff149a2661d404c28ea216
+ b2sums = a4fc3b3f999cb29e1c6c3e6030c113a02afa7e5e64318c1a90cba510de36b9cdadb675c7d8feb7d5305d71722b0b73b5c1870d36fee5734df824d1c68fe482bb
+ b2sums = 5093bc61755faf1641cd99a605e65f84e349bb4870e0822540f2357260bdae11242e8e987be2cc6b55fdee1984ec00cac8f6bff8b44676f929a19823cb5d2d9f
+
+pkgname = automua
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..e25d89956928
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+pkg/
+src/
+automua/
+automua-2022*
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..cd330bb6ae4d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,34 @@
+# Maintainer: HLFH <gaspard@dhautefeuille.eu>
+
+pkgname=automua
+pkgver=2022.4
+pkgrel=1
+pkgdesc="Email client configuration made easy"
+arch=('any')
+license=('GPL3')
+backup=('etc/automua/automua.conf')
+source=('setupvenv.sh'
+ 'automua.sysusers'
+ 'automua.conf'
+ 'automua.service'
+ 'automua.tmpfiles')
+b2sums=('5baa7fb3b143306fc91187bdd430b9f59c5dd84452ed78321747195c441f9f996ecccd9af6d5ba13219d89308fc3c4865deee837438518eb8e1d85b64903c444'
+ '9f5f26ee77c39c9988c60fbfa6ea0e492a00769bc8e827da88d149e78d919f2eff1ac160ff5af82deddeea03581dc150278564bdcf7401e42c337f4977a2ff07'
+ '1ecda927911fe33f96c4a040593e190185b7c5450411c2b26ad4c35953c6d27813316bfff88fa3fcfd48c06fa1f2e4444f23a7ad8dff149a2661d404c28ea216'
+ 'a4fc3b3f999cb29e1c6c3e6030c113a02afa7e5e64318c1a90cba510de36b9cdadb675c7d8feb7d5305d71722b0b73b5c1870d36fee5734df824d1c68fe482bb'
+ '5093bc61755faf1641cd99a605e65f84e349bb4870e0822540f2357260bdae11242e8e987be2cc6b55fdee1984ec00cac8f6bff8b44676f929a19823cb5d2d9f')
+
+package() {
+ mkdir -p "$pkgdir/etc/automua"
+ mkdir -p "$pkgdir/srv/http/automua"
+ cd "$pkgdir/srv/http/automua"
+ install -Dm644 "${srcdir}/setupvenv.sh" "setupvenv.sh"
+ sh setupvenv.sh
+ source .venv/bin/activate
+ pip install -Iv $pkgname==$pkgver
+ pip install mysqlclient
+ install -Dm644 "${srcdir}/automua.sysusers" "${pkgdir}/usr/lib/sysusers.d/automua.conf"
+ install -Dm644 "${srcdir}/automua.conf" "${pkgdir}/etc/automua/automua.conf"
+ install -Dm644 "${srcdir}/automua.service" "${pkgdir}/usr/lib/systemd/system/automua.service"
+ install -Dm644 "${srcdir}/automua.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/automua.conf"
+}
diff --git a/automua.conf b/automua.conf
new file mode 100644
index 000000000000..ba8599ef7dbc
--- /dev/null
+++ b/automua.conf
@@ -0,0 +1,20 @@
+[automua]
+# A typical production setup would use loglevel WARNING.
+loglevel = DEBUG
+# Echo SQL commands into log? Used for debugging.
+db_echo = no
+# In-memory SQLite database
+#db_uri = sqlite:///:memory:
+
+# SQLite database in a UNIX-like file system
+#db_uri = sqlite:////var/lib/automua/db.sqlite
+
+# MySQL database on a remote server. This example does not use an encrypted
+# connection and is therefore *not* recommended for production use.
+db_uri = mysql://automua:REPLACEPASSWORD@localhost/automua
+
+# Number of proxy servers between automua and the client (default: 0).
+# If your logs only show 127.0.0.1 or ::1 as the source IP for incoming
+# connections, proxy_count probably needs to be changed.
+proxy_count = 1
+
diff --git a/automua.service b/automua.service
new file mode 100644
index 000000000000..a09cfdd5662a
--- /dev/null
+++ b/automua.service
@@ -0,0 +1,14 @@
+[Unit]
+After=network.target
+Description=Auto MUA configuration service
+Documentation=https://hlfh.github.io/automua/
+
+[Service]
+Environment=FLASK_APP=automua.server:app
+Environment=FLASK_CONFIG=production
+ExecStart=/srv/http/automua/.venv/bin/python /srv/http/automua/.venv/bin/flask run --host=127.0.0.1 --port=4243
+Restart=always
+User=automua
+
+[Install]
+WantedBy=multi-user.target
diff --git a/automua.sysusers b/automua.sysusers
new file mode 100644
index 000000000000..aab9d1f7342f
--- /dev/null
+++ b/automua.sysusers
@@ -0,0 +1 @@
+u automua - "automua mail autoconfig user" /srv/http/automua
diff --git a/automua.tmpfiles b/automua.tmpfiles
new file mode 100644
index 000000000000..9dbb0084459f
--- /dev/null
+++ b/automua.tmpfiles
@@ -0,0 +1 @@
+Z /srv/http/automua - automua automua
diff --git a/setupvenv.sh b/setupvenv.sh
new file mode 100644
index 000000000000..7052915a326b
--- /dev/null
+++ b/setupvenv.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# vim:ts=4:sw=4:noet
+#
+# Creates a Python 3 virtual environment. The target directory can be passed
+# as a parameter. The default path is '.venv' in the current directory.
+
+dir="${1:-.venv}"
+
+set -e
+if [ -d "${dir}" ]; then
+ echo >&2 "Directory '${dir}' already exists, exiting."
+ exit 1
+fi
+python3 -m venv "${dir}"
+source "${dir}/bin/activate"
+
+set +e
+pip install -U pip hatch wheel || true
+