aboutsummaryrefslogtreecommitdiff
path: root/apks/alps
diff options
context:
space:
mode:
Diffstat (limited to 'apks/alps')
-rw-r--r--apks/alps/APKBUILD45
-rw-r--r--apks/alps/alps.confd11
-rw-r--r--apks/alps/alps.initd23
-rw-r--r--apks/alps/alps.pre-install6
-rw-r--r--apks/alps/fix-statics-dir.patch26
5 files changed, 111 insertions, 0 deletions
diff --git a/apks/alps/APKBUILD b/apks/alps/APKBUILD
new file mode 100644
index 0000000..e7bab57
--- /dev/null
+++ b/apks/alps/APKBUILD
@@ -0,0 +1,45 @@
+# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
+# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
+pkgname=alps
+pkgver=0_git20221018
+pkgrel=0
+_commit=f01fbcbc48db5e65d69a0ebd9d7cb0deb378cf13
+pkgdesc="Simple and extensible webmail"
+url="https://sr.ht/~migadu/alps/"
+arch="all"
+license="MIT"
+makedepends="go"
+install="$pkgname.pre-install"
+subpackages="$pkgname-openrc"
+source="$pkgname-$_commit.tar.gz::https://git.sr.ht/~migadu/alps/archive/$_commit.tar.gz
+ fix-statics-dir.patch
+
+ alps.confd
+ alps.initd
+ "
+builddir="$srcdir/alps-$_commit"
+options="!check net" # no tests in upstream
+
+build() {
+ go build -o alps ./cmd/alps
+}
+
+package() {
+ install -Dm755 alps "$pkgdir"/usr/bin/alps
+
+ install -dm755 "$pkgdir"/var/lib/alps
+ cp -r themes "$pkgdir"/var/lib/alps
+ for asset in plugins/*/public/*.html plugins/*/public/**/*; do
+ install -Dm644 "$asset" "$pkgdir"/var/lib/alps/"$asset"
+ done
+
+ install -Dm755 "$srcdir"/alps.initd "$pkgdir"/etc/init.d/alps
+ install -Dm644 "$srcdir"/alps.confd "$pkgdir"/etc/conf.d/alps
+}
+
+sha512sums="
+682a8dc80f5812a033c57eb91f17a3e2da7320a642a04f08abda2baeb93a69528c446323d089773061f6a6b91dcda7e4dfa0885285532d310bdcc1565d6d3e81 alps-f01fbcbc48db5e65d69a0ebd9d7cb0deb378cf13.tar.gz
+789b4cae9b2c4acb5b05288c4f9858de1b5cfda87bc96c40505e9447ec9ad39fdabbd5af0c65007c51a5f3a425602ea7a81d3f6c62894dddf6790fe26793755c fix-statics-dir.patch
+61c1b05851ae05fbf51cb8eb060c5677de7145a07dac3a194a3f7513b2ff3bf5f3792a749d1a2eef09fc6378f2fbf2021cc49dffe652f51230120c40a7062b6c alps.confd
+6e109577d662ce61d2b753e5b82237827646f10d0af02b10b3f184a10bb747c3c8303e7d20a5cc2b7c31ac4a6f3aef62290c068868e647c9b1ce711dfb6e025a alps.initd
+"
diff --git a/apks/alps/alps.confd b/apks/alps/alps.confd
new file mode 100644
index 0000000..cd61010
--- /dev/null
+++ b/apks/alps/alps.confd
@@ -0,0 +1,11 @@
+# Configuration for /etc/init.d/alps
+
+# space-separated list of imap/smtp servers
+servers="imap://localhost"
+
+theme="alps"
+listen_address=":1323"
+command_user="alps:alps"
+
+# comment this out for old style service management
+supervisor=supervise-daemon
diff --git a/apks/alps/alps.initd b/apks/alps/alps.initd
new file mode 100644
index 0000000..307c6e3
--- /dev/null
+++ b/apks/alps/alps.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+
+name="alps webmail server"
+
+command="/usr/bin/alps"
+command_args="${listen_address:+-addr $listen_address} ${theme:+-theme $theme} $servers"
+: ${command_user:="alps:alps"}
+command_background=yes
+directory="/var/lib/alps"
+pidfile="/run/alps.pid"
+
+output_log="/var/log/alps.log"
+error_log="/var/log/alps.log"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath -d -m 755 -o "$command_user" /var/lib/alps
+ checkpath -f -m 644 -o "$command_user" /var/log/alps.log
+}
diff --git a/apks/alps/alps.pre-install b/apks/alps/alps.pre-install
new file mode 100644
index 0000000..176a801
--- /dev/null
+++ b/apks/alps/alps.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S alps
+adduser -S -D -H -h /var/lib/alps -s /sbin/nologin -G alps -g alps alps
+
+exit 0
diff --git a/apks/alps/fix-statics-dir.patch b/apks/alps/fix-statics-dir.patch
new file mode 100644
index 0000000..72eaffa
--- /dev/null
+++ b/apks/alps/fix-statics-dir.patch
@@ -0,0 +1,26 @@
+diff --git a/cmd/alps/main.go b/cmd/alps/main.go
+index 5a00957..f537177 100644
+--- a/cmd/alps/main.go
++++ b/cmd/alps/main.go
+@@ -23,7 +23,7 @@ import (
+ _ "git.sr.ht/~migadu/alps/plugins/viewtext"
+ )
+
+-var themesPath = "./themes"
++var themesPath = "/var/lib/alps/themes"
+
+ func main() {
+ var (
+diff --git a/plugin.go b/plugin.go
+index e634f02..43b8164 100644
+--- a/plugin.go
++++ b/plugin.go
+@@ -7,7 +7,7 @@ import (
+ )
+
+ // PluginDir is the path to the plugins directory.
+-const PluginDir = "plugins"
++const PluginDir = "/var/lib/alps/plugins"
+
+ // Plugin extends alps with additional functionality.
+ type Plugin interface {