From 1de6bdf0f68ba73f71a118cd04f7b12bfce5fcd9 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Wed, 24 Apr 2024 18:32:46 +0200
Subject: [PATCH 01/14] testing/grommunio-gromox: new aport

Open Source Groupware Solution
---
 testing/grommunio-gromox/APKBUILD             | 168 ++++++++++++++++++
 testing/grommunio-gromox/autodiscover.ini     |  19 ++
 .../grommunio-gromox.pre-install              |  17 ++
 .../gromox-delivery-queue.initd               |  12 ++
 .../grommunio-gromox/gromox-delivery.initd    |  12 ++
 testing/grommunio-gromox/gromox-event.initd   |  12 ++
 testing/grommunio-gromox/gromox-fpm.conf      |  15 ++
 testing/grommunio-gromox/gromox-http.initd    |  12 ++
 testing/grommunio-gromox/gromox-imap.initd    |  12 ++
 testing/grommunio-gromox/gromox-midb.initd    |  12 ++
 testing/grommunio-gromox/gromox-pop3.initd    |  12 ++
 testing/grommunio-gromox/gromox-timer.initd   |  12 ++
 testing/grommunio-gromox/gromox-zcore.initd   |  12 ++
 testing/grommunio-gromox/http.cfg             |   8 +
 testing/grommunio-gromox/imap.cfg             |   6 +
 testing/grommunio-gromox/mysql_adaptor.cfg    |   5 +
 testing/grommunio-gromox/pop3.cfg             |   5 +
 testing/grommunio-gromox/smtp.cfg             |   2 +
 testing/grommunio-gromox/zcore.cfg            |   2 +
 19 files changed, 355 insertions(+)
 create mode 100644 testing/grommunio-gromox/APKBUILD
 create mode 100644 testing/grommunio-gromox/autodiscover.ini
 create mode 100644 testing/grommunio-gromox/grommunio-gromox.pre-install
 create mode 100644 testing/grommunio-gromox/gromox-delivery-queue.initd
 create mode 100644 testing/grommunio-gromox/gromox-delivery.initd
 create mode 100644 testing/grommunio-gromox/gromox-event.initd
 create mode 100644 testing/grommunio-gromox/gromox-fpm.conf
 create mode 100644 testing/grommunio-gromox/gromox-http.initd
 create mode 100644 testing/grommunio-gromox/gromox-imap.initd
 create mode 100644 testing/grommunio-gromox/gromox-midb.initd
 create mode 100644 testing/grommunio-gromox/gromox-pop3.initd
 create mode 100644 testing/grommunio-gromox/gromox-timer.initd
 create mode 100644 testing/grommunio-gromox/gromox-zcore.initd
 create mode 100644 testing/grommunio-gromox/http.cfg
 create mode 100644 testing/grommunio-gromox/imap.cfg
 create mode 100644 testing/grommunio-gromox/mysql_adaptor.cfg
 create mode 100644 testing/grommunio-gromox/pop3.cfg
 create mode 100644 testing/grommunio-gromox/smtp.cfg
 create mode 100644 testing/grommunio-gromox/zcore.cfg

diff --git a/testing/grommunio-gromox/APKBUILD b/testing/grommunio-gromox/APKBUILD
new file mode 100644
index 000000000000..efc91b068a6f
--- /dev/null
+++ b/testing/grommunio-gromox/APKBUILD
@@ -0,0 +1,168 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-gromox
+subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-openrc"
+pkgver=2.27
+pkgrel=0
+pkgdesc="Open Source Groupware Solution"
+arch="all !riscv64"
+url="https://grommunio.com/"
+license="AGPL-3.0-or-later"
+_php=php83
+install="$pkgname.pre-install"
+depends="
+	grommunio-common
+	mariadb
+	$_php
+	$_php-fpm
+	postfix
+	redis
+	!kopano-core
+"
+
+makedepends="
+	autoconf
+	automake
+	curl-dev
+	gumbo-parser-dev
+	jsoncpp-dev
+	libhx-dev
+	libtool
+	libvmime-dev
+	libxml2-dev
+	linux-pam-dev
+	linux-headers
+	mariadb-dev
+	musl-dev
+	openldap-dev
+	openssl-dev
+	$_php
+	$_php-dev
+	sqlite-dev
+	tinyxml2-dev
+	zlib-dev
+	zstd-dev
+"
+
+pkgusers="grommunio gromox"
+pkggroups="grommunio gromox gromoxcf"
+
+source="
+	https://github.com/grommunio/gromox/archive/refs/tags/gromox-$pkgver.tar.gz
+
+	gromox-delivery-queue.initd
+	gromox-delivery.initd
+	gromox-event.initd
+	gromox-http.initd
+	gromox-imap.initd
+	gromox-midb.initd
+	gromox-pop3.initd
+	gromox-timer.initd
+	gromox-zcore.initd
+	gromox-fpm.conf
+	http.cfg
+	imap.cfg
+	mysql_adaptor.cfg
+	pop3.cfg
+	smtp.cfg
+	zcore.cfg
+	autodiscover.ini
+"
+
+builddir="$srcdir/gromox-gromox-$pkgver/"
+
+prepare() {
+	default_prepare
+	autoreconf -fiv
+}
+
+build() {
+	export CXXFLAGS="$CXXFLAGS -fpermissive"
+	./configure --prefix=/usr
+
+	make
+}
+
+check() {
+	make check
+}
+
+package() {
+	mkdir -p "$pkgdir"
+	make install DESTDIR="$(realpath $pkgdir)"
+
+	# prepare services
+	for item in delivery-queue delivery event http imap midb pop3 timer zcore; do
+		install -Dm 0755 "$srcdir/gromox-$item.initd" "$pkgdir/etc/init.d/$item"
+	done
+
+	# prepare configuration. some files are predefined, others are generated
+	x500_org_name=$(awk 'BEGIN { srand(); print int(rand()*32768) }' /dev/null | md5sum | head -c 10)
+	#sed -i.bak "s/RANDOM/$(echo $RANDOM | md5sum | head -c 10)/" "$srcdir/zcore.cfg"
+	sed -i.bak "s/<x500_org_name>/$x500_org_name/" "$srcdir/zcore.cfg"
+	sed -i.bak "s/<x500_org_name>/$x500_org_name/" "$srcdir/autodiscover.ini"
+	install -dm 0750 "$srcdir/gromox"
+	install -Dm 0640 "$srcdir/zcore.cfg" "$pkgdir/etc/gromox/zcore.cfg"
+	grep x500_org_name > "$pkgdir/etc/gromox/exchange_emsmdb.cfg" < "$srcdir/zcore.cfg"
+	grep x500_org_name > "$pkgdir/etc/gromox/exchange_nsp.cfg" < "$srcdir/zcore.cfg"
+	grep x500_org_name > "$pkgdir/etc/gromox/exmdb_local.cfg" < "$srcdir/zcore.cfg"
+	grep x500_org_name > "$pkgdir/etc/gromox/exmdb_provider.cfg" < "$srcdir/zcore.cfg"
+	grep default_dom > "$pkgdir/etc/gromox/delivery.cfg" < "$srcdir/zcore.cfg"
+	install -Dm 0640 "$srcdir/zcore.cfg" "$pkgdir/etc/gromox/midb.cfg"
+
+
+	for item in http imap mysql_adaptor pop3 smtp; do
+		install -Dm 0640 "$srcdir/$item.cfg" "$pkgdir/etc/gromox/$item.cfg"
+	done
+
+	# autodiscover.ini
+	install -Dm 0640 "$srcdir/autodiscover.ini" "$pkgdir/etc/gromox/autodiscover.ini"
+
+	# php-fpm
+	install -Dm 0644 "$srcdir/gromox-fpm.conf" "$pkgdir/etc/$_php/php-fpm.d/gromox.conf"
+	rm -f "$pkgdir/usr/share/gromox/fpm-gromox.conf.sample"
+
+	# license
+	install -Dm 0644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# create database directories
+	for i in /var/lib/gromox \
+		/var/lib/gromox/domain \
+		/var/lib/gromox/user \
+		/var/lib/gromox/queue \
+		/var/lib/gromox/queue/cache \
+		/var/lib/gromox/queue/mess \
+		/var/lib/gromox/queue/save \
+		/var/lib/gromox/queue/timer; do
+		install -dm 0770 -g gromox -o gromox "$pkgdir/$i"
+	done
+
+	# make sure all files in /etc/gromox are owned by grommunio:grmoxcf
+	chown -R grommunio:gromoxcf "$pkgdir/etc/gromox"
+	find  "$pkgdir/etc/gromox" -type f -exec chmod 0640 {} ';'
+	find  "$pkgdir/etc/gromox" -type d -exec chmod 0750 {} ';'
+
+	# remove unnecessary folders
+	rm -Rf "$pkgdir/usr/lib/systemd" "$pkgdir/usr/lib/sysusers.d/" "$pkgdir/usr/lib/tmpfiles.d/"
+
+}
+
+sha512sums="
+98dcfc16f64a440a1efda8501f4d72636e7ab570946f5f573895c347a9f451573ac2b55c9032ad6b06e9e29a123e0dbe386a96556f0448ef7b8ac36ce28f2f18  gromox-2.27.tar.gz
+444ddd5ff60eff1bbfeaccc96aaa98aaf7c2d0122d5fec3f9faa3339ebd90e423718113853787c57aea8354fa83e68e455938e5a1294d35445b06d54074f2e60  gromox-delivery-queue.initd
+afdf55901ac406ccb8ddb87a337cf87af9b67f5fb850dd66ee58b12ee817c7ecd6bd25e349d70fd53940e7c79516fe7dde473c738f1c834b3a558988bf0a7e8a  gromox-delivery.initd
+ee95b1f8397a270f434ae343fbb2187915b658198a09749b794e1811ca697f6cf2465e8b58ad0ba9ea3d8b14b7cc21355d0123845f6f9fecd751957a4bab2cfe  gromox-event.initd
+3be4aba7806c37da9618e5b9abefed9aad15ec752ae7ff306e998a4a445efcfd89d4b6498924104feb915258e5a1869171f3420a71dad0f1d913ad1d071f603d  gromox-http.initd
+390723a599e9805bf9de5f6dfe61ef9c9d2e37389ecf08869eee4a8192d3b4f3848e9b847a75e55fb9022f577fad43db7993c5430d4f8c81f39658d2093a4a13  gromox-imap.initd
+cd1b1e9c14485d9fa2c4ac1db3095e5a29cc210324b190a68ff51899e8a92f27d7caa0cb4aa8b9cbb2e355aff95bf47f1e7b3811deff316245c07222168badc5  gromox-midb.initd
+db91aa7e775a2b8c8756b48c1a7c2b3b2241b3b69d13486584b42c24da92420b65571b0d6b3fdb95dac6cc95bf9f2dffb894357511d084c5bff5bf2a5f74975e  gromox-pop3.initd
+011d24cd10f113646cf0f13cc65198b0df862e59908e1f4dcd931d410954ab817b48fe818c6fe845d5c62228d6373380ba4afa8aefc85c57886004b84df0be76  gromox-timer.initd
+cb3cf8b1d155ebdfdf948ff2104838b17ff8d915ac5bd2945a6fca2bba1b8a76fd54345cc865ea86a957f3d11e1b32c0b5c0f4f69ab4b1a3bac9116e616b060e  gromox-zcore.initd
+adb0da75223284a1081166597ef42d267d2187f663b7da7c66eae517e0af179217464a1e7ec6b2d082f7dd0b506e1e980724cf1fec081719b253e8ea44a37558  gromox-fpm.conf
+768b63b8d6431b47546753481e67cbd27797e8813dce4ba5109b511ee751972b9b7a137d0c933f29156e5d5b1f1d9b3d1c4733d522be6141b1b56b0b7a90b2e0  http.cfg
+f6bfdf6e44ed1cb7718a71fc75920d0a92b22fd17166d85c43273b53c57931344aaa1be0b61b713f2f7d586ea621c1077b6585a4fc553198e49069db8e6a0396  imap.cfg
+a4b54f32a4f8b932ea93dd71c1eaccac50a445d960f3ab37913481db3b80daad51238f4b826331111e939f5a75d522619fff9566042670b578c65c477754bd64  mysql_adaptor.cfg
+1612fb72fa8417ef54670f82e829c1307256ab87b8ee478d9bddf32599888de407749ee4cd97c52e55dc72138964db531af061d9c8426d6dacb692a48b4bfbef  pop3.cfg
+04e234844466beff40a67d8b0f1eeea93ca1d801c88127ccb4f4475665c16c3b3cc11077e32fc34e010b63af2557e9b3a214213ee5382b3c1ffa4c3ae131dc4a  smtp.cfg
+b7f86af6b5a7f0d075c4c46c33c513db41ebd59a59a6e53613c2f1fcb09a03080eaede57e6040d609892d5c910dbbe03de3bf70035ecd8ed63f3161acb3425ab  zcore.cfg
+1323813c698159340436c7023309abc26bef3dbfa17b6ea331f172cd26c6d7eb207fcfe4a8b4ff88042f7895ea49c6d09cfa247cb6586d97928b211d91528e24  autodiscover.ini
+"
diff --git a/testing/grommunio-gromox/autodiscover.ini b/testing/grommunio-gromox/autodiscover.ini
new file mode 100644
index 000000000000..dd24e4dc9502
--- /dev/null
+++ b/testing/grommunio-gromox/autodiscover.ini
@@ -0,0 +1,19 @@
+[database]
+host = localhost
+username = 'grommunio'
+password = <password>
+dbname = 'grommunio'
+
+[exchange]
+organization = <x500_org_name>
+hostname = mail.example.local
+mapihttp = 1
+
+[default]
+timezone = 'Europe/Vienna'
+
+[system]
+
+[http-proxy]
+/var/lib/gromox/user = mail.example.local
+/var/lib/gromox/domain = mail.example.local
diff --git a/testing/grommunio-gromox/grommunio-gromox.pre-install b/testing/grommunio-gromox/grommunio-gromox.pre-install
new file mode 100644
index 000000000000..038d45b912f3
--- /dev/null
+++ b/testing/grommunio-gromox/grommunio-gromox.pre-install
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# user/group for gromox services
+addgroup -S gromox 2>/dev/null
+adduser -S -D -H -h /var/run/gromox -s /sbin/nologin -G gromox -g "Gromox services" gromox 2>/dev/null
+
+# group for configuration files
+addgroup -S gromoxcf 2>/dev/null
+addgroup gromox gromoxcf 2>/dev/null
+
+# user/group for administration services
+addgroup -S grommunio 2>/dev/null
+adduser -S -D -H -h /var/run/grommunio -s /sbin/nologin -G grommunio -g "Grommunio administration" grommunio 2>/dev/null
+addgroup grommunio gromox 2>/dev/null
+addgroup grommunio gromoxcf 2>/dev/null
+
+exit 0
diff --git a/testing/grommunio-gromox/gromox-delivery-queue.initd b/testing/grommunio-gromox/gromox-delivery-queue.initd
new file mode 100644
index 000000000000..c60317fe3e02
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-delivery-queue.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/delivery-queue"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-delivery.initd b/testing/grommunio-gromox/gromox-delivery.initd
new file mode 100644
index 000000000000..a1f946e76546
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-delivery.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/delivery"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-event.initd b/testing/grommunio-gromox/gromox-event.initd
new file mode 100644
index 000000000000..d90afbb5cad3
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-event.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/event"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-fpm.conf b/testing/grommunio-gromox/gromox-fpm.conf
new file mode 100644
index 000000000000..09d930a5baf9
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-fpm.conf
@@ -0,0 +1,15 @@
+[gromox]
+user = gromox
+group = gromox
+listen = /run/gromox/php-fpm.sock
+listen.owner = gromox
+listen.group = gromox
+listen.mode = 0660
+pm = dynamic
+pm.max_children = 100
+pm.start_servers = 10
+pm.min_spare_servers = 10
+pm.max_spare_servers = 20
+catch_workers_output = yes
+php_admin_value[error_log] = /var/log/gromox/php-fpm.log
+php_admin_value[memory_limit] = 256M
diff --git a/testing/grommunio-gromox/gromox-http.initd b/testing/grommunio-gromox/gromox-http.initd
new file mode 100644
index 000000000000..9ec73476238b
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-http.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/http"
+
+depend() {
+    need mariadb atd
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-imap.initd b/testing/grommunio-gromox/gromox-imap.initd
new file mode 100644
index 000000000000..82e43ba08570
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-imap.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/imap"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-midb.initd b/testing/grommunio-gromox/gromox-midb.initd
new file mode 100644
index 000000000000..5f1902e9de78
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-midb.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/midb"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-pop3.initd b/testing/grommunio-gromox/gromox-pop3.initd
new file mode 100644
index 000000000000..a39f3728f61e
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-pop3.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/pop3"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-timer.initd b/testing/grommunio-gromox/gromox-timer.initd
new file mode 100644
index 000000000000..ac4ae0c301cf
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-timer.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/timer"
+
+depend() {
+    need mariadb
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/gromox-zcore.initd b/testing/grommunio-gromox/gromox-zcore.initd
new file mode 100644
index 000000000000..31075307576f
--- /dev/null
+++ b/testing/grommunio-gromox/gromox-zcore.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+name=$RC_SVCNAME
+command="/usr/libexec/gromox/zcore"
+
+depend() {
+    need mariadb atd
+}
+
+start_pre() {
+    checkpath -d -m 750 -o gromox:gromox /run/gromox
+}
diff --git a/testing/grommunio-gromox/http.cfg b/testing/grommunio-gromox/http.cfg
new file mode 100644
index 000000000000..e6512397cc40
--- /dev/null
+++ b/testing/grommunio-gromox/http.cfg
@@ -0,0 +1,8 @@
+listen_port=10080
+http_support_ssl=true
+listen_ssl_port=10443
+host_id=mail.example.local
+#http_certificate_path=/etc/grommunio-common/ssl/server-bundle.pem
+#http_private_key_path=/etc/grommunio-common/ssl/server.key
+default_domain=example.com
+
diff --git a/testing/grommunio-gromox/imap.cfg b/testing/grommunio-gromox/imap.cfg
new file mode 100644
index 000000000000..2a7ab23f8fa7
--- /dev/null
+++ b/testing/grommunio-gromox/imap.cfg
@@ -0,0 +1,6 @@
+imap_support_starttls=true
+listen_ssl_port=993
+#imap_certificate_path=/etc/grommunio-common/ssl/server-bundle.pem
+#imap_private_key_path=/etc/grommunio-common/ssl/server.key
+default_domain=example.com
+
diff --git a/testing/grommunio-gromox/mysql_adaptor.cfg b/testing/grommunio-gromox/mysql_adaptor.cfg
new file mode 100644
index 000000000000..e9c91f5f308b
--- /dev/null
+++ b/testing/grommunio-gromox/mysql_adaptor.cfg
@@ -0,0 +1,5 @@
+mysql_host=localhost
+mysql_username=grommunio
+mysql_password=<password>
+mysql_dbname=grommunio
+schema_upgrade=host:mail.example.local
diff --git a/testing/grommunio-gromox/pop3.cfg b/testing/grommunio-gromox/pop3.cfg
new file mode 100644
index 000000000000..4ad30bfadc23
--- /dev/null
+++ b/testing/grommunio-gromox/pop3.cfg
@@ -0,0 +1,5 @@
+pop3_support_stls=true
+listen_ssl_port=995
+#pop3_certificate_path=/etc/grommunio-common/ssl/server-bundle.pem
+#pop3_private_key_path=/etc/grommunio-common/ssl/server.key
+default_domain=example.com
diff --git a/testing/grommunio-gromox/smtp.cfg b/testing/grommunio-gromox/smtp.cfg
new file mode 100644
index 000000000000..0f689b292b14
--- /dev/null
+++ b/testing/grommunio-gromox/smtp.cfg
@@ -0,0 +1,2 @@
+listen_port=24
+default_domain=example.com
diff --git a/testing/grommunio-gromox/zcore.cfg b/testing/grommunio-gromox/zcore.cfg
new file mode 100644
index 000000000000..2e56f0aef94f
--- /dev/null
+++ b/testing/grommunio-gromox/zcore.cfg
@@ -0,0 +1,2 @@
+default_domain=example.com
+x500_org_name=<x500_org_name>
-- 
GitLab


From 4b77fbf7f66d17588d829f4bc527f3af79c43cef Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Mon, 30 Aug 2021 04:41:26 +0200
Subject: [PATCH 02/14] testing/grommunio-sync: new aport

Exchange ActiveSync interface for grommunio
---
 testing/grommunio-sync/APKBUILD               | 69 +++++++++++++++++++
 .../grommunio-sync/grommunio-sync.pre-install |  6 ++
 2 files changed, 75 insertions(+)
 create mode 100644 testing/grommunio-sync/APKBUILD
 create mode 100644 testing/grommunio-sync/grommunio-sync.pre-install

diff --git a/testing/grommunio-sync/APKBUILD b/testing/grommunio-sync/APKBUILD
new file mode 100644
index 000000000000..d647dfe8b54a
--- /dev/null
+++ b/testing/grommunio-sync/APKBUILD
@@ -0,0 +1,69 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-sync
+pkgdesc="Exchange ActiveSync interface for grommunio"
+pkgver=2.0_git20240226
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.kopano.com/"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+_php=php83
+install="$pkgname.pre-install"
+depends="grommunio-gromox
+	grommunio-mapi-header-php
+	$_php
+	$_php-curl
+	$_php-gettext
+	$_php-iconv
+	$_php-json
+	$_php-mbstring
+	$_php-openssl
+	$_php-pecl-redis
+	$_php-pdo_sqlite
+	$_php-posix
+	$_php-session
+	$_php-simplexml
+	$_php-soap"
+
+_commithash=316257884382020bebfb4e3a2853cb560f3b208b
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-sync/archive/$_commithash.tar.gz"
+
+builddir="$srcdir/grommunio-sync-$_commithash/"
+
+build() {
+	:
+}
+
+package() {
+	# webapp
+	install -dm755 "$pkgdir/usr/share/webapps/$pkgname/"
+	cp -rp -- * "$pkgdir/usr/share/webapps/$pkgname/"
+
+	# license
+	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# nginx conf
+	sed -i "s@/var/log/grommunio/@/var/log/nginx/@" build/grommunio-sync.conf
+	install -Dpm644 build/grommunio-sync.conf "$pkgdir/usr/share/grommunio-common/nginx/locations.d/grommunio-sync.conf"
+	install -Dpm644 build/grommunio-sync-upstream.conf "$pkgdir/usr/share/grommunio-common/nginx/upstreams.d/grommunio-sync.conf"
+
+	# php-fpm
+	install -Dpm644 build/pool-grommunio-sync.conf "$pkgdir/etc/$_php/php-fpm.d/pool-grommunio-sync.conf"
+
+	# logrotate
+	install -Dm644 build/grommunio-sync.lr "$pkgdir/etc/logrotate.d/grommunio-sync"
+
+	# web config
+	install -Dm644 config.php "$pkgdir/etc/grommunio-sync/config.php"
+	ln -sf "/etc/grommunio-sync/config.php" "$pkgdir/usr/share/webapps/grommunio-sync/config.php"
+
+	# remove unnecessary files
+	rm -rf "$pkgdir/usr/share/webapps/grommunio-sync/build"
+	rm -f "$pkgdir/usr/share/webapps/grommunio-sync/LICENSE"
+
+}
+
+sha512sums="
+6df33c39e114c5439548d6c465a57d0b2885acac77349cde7de7f3a0a6a3fb339747f62b77c46f25300a60ffafa1be690ebaeff5c6625e11aa9a51fba2f7d67a  grommunio-sync-2.0_git20240226.tar.gz
+"
diff --git a/testing/grommunio-sync/grommunio-sync.pre-install b/testing/grommunio-sync/grommunio-sync.pre-install
new file mode 100644
index 000000000000..1332c267f4e4
--- /dev/null
+++ b/testing/grommunio-sync/grommunio-sync.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S grosync 2>/dev/null
+adduser -S -D -H -h /usr/share/grommunio-sync -s /sbin/nologin -G grosync -g "Grommunio ActiveSync" grosync 2>/dev/null
+
+exit 0
-- 
GitLab


From 007db89f577e8221f42739dc69aa754b57e61f9c Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Tue, 31 Aug 2021 03:45:09 +0200
Subject: [PATCH 03/14] testing/grommunio-web: new aport

WebApp for grommunio
---
 testing/grommunio-web/0001-makefile.patch     | 20 +++++
 .../grommunio-web/0002-config-php-dist.patch  | 21 +++++
 .../0003-plugins-files-config-php.patch       | 12 +++
 testing/grommunio-web/APKBUILD                | 87 +++++++++++++++++++
 .../grommunio-web/grommunio-web.pre-install   |  6 ++
 5 files changed, 146 insertions(+)
 create mode 100644 testing/grommunio-web/0001-makefile.patch
 create mode 100644 testing/grommunio-web/0002-config-php-dist.patch
 create mode 100644 testing/grommunio-web/0003-plugins-files-config-php.patch
 create mode 100644 testing/grommunio-web/APKBUILD
 create mode 100644 testing/grommunio-web/grommunio-web.pre-install

diff --git a/testing/grommunio-web/0001-makefile.patch b/testing/grommunio-web/0001-makefile.patch
new file mode 100644
index 000000000000..871e9d62981a
--- /dev/null
+++ b/testing/grommunio-web/0001-makefile.patch
@@ -0,0 +1,20 @@
+diff -ruN a/Makefile b/Makefile
+--- a/Makefile	2024-03-06 10:42:16.333816043 +0100
++++ b/Makefile	2024-03-06 10:42:34.613808357 +0100
+@@ -95,11 +95,11 @@
+ 	find $(DESTDIR) -iname "*gpl*.txt" -exec rm -f {} \;
+ 
+ js: $(JSDEPLOY)/fingerprint.js $(JSDEPLOY)/resize.js $(JSDEPLOY)/grommunio.js $(JSDEPLOY)/extjs-mod/extjs-mod.js $(JSDEPLOY)/extjs/ext-base-all.js $(DESTDIR)/client/third-party/ux-thirdparty.js $(DEPLOYPURIFYJS) $(JSDEPLOY)/filepreviewer/pdfjs/build/pdf.sandbox.js $(JSDEPLOY)/filepreviewer/pdfjs/build/pdf.worker.js $(JSDEPLOY)/filepreviewer/pdfjs/build/pdf.js $(JSDEPLOY)/filepreviewer/pdfjs/web/viewer.js $(JSDEPLOY)/filepreviewer/ViewerJS/ImageViewerPlugin.js $(JSDEPLOY)/filepreviewer/ViewerJS/MultimediaViewerPlugin.js $(JSDEPLOY)/filepreviewer/ViewerJS/ODFViewerPlugin.js $(JSDEPLOY)/filepreviewer/ViewerJS/UnknownFilePlugin.js $(JSDEPLOY)/filepreviewer/ViewerJS/viewer.js $(JSDEPLOY)/filepreviewer/ViewerJS/video-js/video.js
+-	cp -rn client/tinymce $(DESTDIR)/client/
+-	cp -rn client/tinymce-languages $(DESTDIR)/client/
+-	cp -rn client/tinymce-plugins $(DESTDIR)/client/
+-	cp -rn client/extjs $(DESTDIR)/client/
+-	cp -rn client/filepreviewer $(DESTDIR)/client/
++	cp -r client/tinymce $(DESTDIR)/client/
++	cp -r client/tinymce-languages $(DESTDIR)/client/
++	cp -r client/tinymce-plugins $(DESTDIR)/client/
++	cp -r client/extjs $(DESTDIR)/client/
++	cp -r client/filepreviewer $(DESTDIR)/client/
+ 	rm $(DESTDIR)/client/extjs/ext-base.js $(DESTDIR)/client/extjs/ext-base-debug.js $(DESTDIR)/client/extjs/ext-all.js $(DESTDIR)/client/filepreviewer/pdfjs/web/debugger.js
+ 
+ $(DESTDIR)/%.php: %.php
diff --git a/testing/grommunio-web/0002-config-php-dist.patch b/testing/grommunio-web/0002-config-php-dist.patch
new file mode 100644
index 000000000000..eb4b7a048b5c
--- /dev/null
+++ b/testing/grommunio-web/0002-config-php-dist.patch
@@ -0,0 +1,21 @@
+diff -ruN a/config.php.dist b/config.php.dist
+--- a/config.php.dist	2024-03-06 10:53:34.113527229 +0100
++++ b/config.php.dist	2024-03-06 10:55:15.483483870 +0100
+@@ -49,7 +49,7 @@
+ 
+ 	// Defines the temp path (absolute). Here uploaded attachments will be saved.
+ 	// The web client doesn't work without this directory.
+-	define("TMP_PATH", "/var/lib/grommunio-web/tmp");
++	define("TMP_PATH", "/var/tmp/grommunio-web");
+ 
+ 	// Define the path to the plugin directory (No slash at the end)
+ 	define("PATH_PLUGIN_DIR", "plugins");
+@@ -67,7 +67,7 @@
+ 	define("APPDATA_DIR", "appdata");
+ 
+ 	// Path used for full text index of every user
+-	define("SQLITE_INDEX_PATH", "/var/lib/grommunio-web/sqlite-index");
++	define("SQLITE_INDEX_PATH", "/var/cache/grommunio-web/sqlite-index");
+ 
+ 	// General grommunio Web theme. This will be loaded by default for every user
+ 	// (if the theme is installed as a plugin)
diff --git a/testing/grommunio-web/0003-plugins-files-config-php.patch b/testing/grommunio-web/0003-plugins-files-config-php.patch
new file mode 100644
index 000000000000..95059d0e41f5
--- /dev/null
+++ b/testing/grommunio-web/0003-plugins-files-config-php.patch
@@ -0,0 +1,12 @@
+diff -ruN a/plugins/files/config.php b/plugins/files/config.php
+--- a/plugins/files/config.php	2024-03-06 11:00:28.653349922 +0100
++++ b/plugins/files/config.php	2024-03-06 11:01:01.823335725 +0100
+@@ -28,7 +28,7 @@
+  * The directory where to save cache files for phpfastcache.
+  * This is a fallback setting, redis should be always available.
+  */
+-define('PLUGIN_FILES_CACHE_DIR', "/var/lib/grommunio-web/plugin_files");
++define('PLUGIN_FILES_CACHE_DIR', "/var/cache/grommunio-web/plugin_files");
+ 
+ /*
+  * Set the verbosity of the plugin.
diff --git a/testing/grommunio-web/APKBUILD b/testing/grommunio-web/APKBUILD
new file mode 100644
index 000000000000..cda77b2d0a5c
--- /dev/null
+++ b/testing/grommunio-web/APKBUILD
@@ -0,0 +1,87 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-web
+pkgdesc="Web user interface for grommunio"
+pkgver=3.7
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.grommunio.com"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+_php=php83
+install="$pkgname.pre-install"
+depends="grommunio-gromox
+	grommunio-mapi-header-php
+	$_php
+	$_php-gettext
+	$_php-bcmath
+	$_php-ctype
+	$_php-curl
+	$_php-dom
+	$_php-gd
+	$_php-gettext
+	$_php-iconv
+	$_php-mbstring
+	$_php-openssl
+	$_php-sodium
+	$_php-sqlite3
+	$_php-sysvshm
+	$_php-zip
+	"
+
+makedepends="libxml2-utils $_php-gettext npm gettext"
+
+source="https://github.com/grommunio/grommunio-web/archive/refs/tags/grommunio-web-$pkgver.tar.gz
+	0001-makefile.patch
+	0002-config-php-dist.patch
+	0003-plugins-files-config-php.patch
+	"
+
+builddir="$srcdir/grommunio-web-grommunio-web-$pkgver"
+
+build() {
+	make -j1
+}
+
+package() {
+	# webapp
+	install -dm0755 "$pkgdir/usr/share/webapps/"
+	cp -rp deploy "$pkgdir/usr/share/webapps/$pkgname"
+
+	# license
+	install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# nginx conf
+	sed -i "s@/var/lib/grommunio-web@/var/tmp/grommunio-web@" build/grommunio-web.conf
+	install -Dpm644 build/grommunio-web.conf "$pkgdir/usr/share/grommunio-common/nginx/locations.d/grommunio-web.conf"
+	install -Dpm644 build/grommunio-web-upstream.conf "$pkgdir/usr/share/grommunio-common/nginx/upstreams.d/grommunio-web.conf"
+
+	# php-fpm
+	install -Dpm644 build/pool-grommunio-web.conf "$pkgdir/etc/$_php/php-fpm.d/pool-grommunio-web.conf"
+
+	# web config
+	install -Dm644 config.php.dist "$pkgdir/etc/grommunio-web/config.php"
+	ln -sf "/etc/grommunio-web/config.php" "$pkgdir/usr/share/webapps/grommunio-web/config.php"
+		rm -f "$pkgdir/usr/share/webapps/grommunio-web/config.php.dist"
+	rm -f "$pkgdir/usr/share/webapps/grommunio-web/debug.php.dist"
+
+	# plugin config
+	for dir in "$pkgdir/usr/share/webapps/grommunio-web/plugins"/*; do
+		plugindir=$(basename "$dir")
+		if [ -f "$pkgdir/usr/share/webapps/grommunio-web/plugins/$plugindir/config.php" ]; then
+			mv "$pkgdir/usr/share/webapps/grommunio-web/plugins/$plugindir/config.php" "$pkgdir/etc/grommunio-web/config-$plugindir.php"
+			ln -s "/etc/grommunio-web/config-$plugindir.php" "$pkgdir/usr/share/webapps/grommunio-web/plugins/$plugindir/config.php"
+		fi
+	done
+
+	# npm gives ownership of ALL FILES to build user
+	# https://bugs.archlinux.org/task/63396
+	chown -R root:root "$pkgdir"
+
+}
+
+sha512sums="
+4bd72cbfbe7dd156c8a8a6b4f58e8c78c1fe457eb5b90a159a56613e209f7fdde5c2a7dd315c8375f5030a938257602d1b9cb503df521a8f30956a343fc14d73  grommunio-web-3.7.tar.gz
+fcfb070ab0bb8cca6f24221fe66eeac7e0c33981c16fff947db7509cc73d39b086710e5fd75bce34a230fa18bc10828d87410d98d147d31cc6ae1c16c41b48ae  0001-makefile.patch
+aaf924c834454078e512a7dff44fca647416eabb328e90e7cc1d78873c2ecb8f5f4a139284f8a4a4c9119ea8aec61d34d343ec1e8bced77f3dfbcdabae32d0d7  0002-config-php-dist.patch
+2e3f55bc799c712ecf453cacd9da74893b07f8cf9ec1b6954993ae15a229219c612b632b372f9bc69ae6f8eb010c65484b7b55c3e90af3a0049c525321ba606e  0003-plugins-files-config-php.patch
+"
diff --git a/testing/grommunio-web/grommunio-web.pre-install b/testing/grommunio-web/grommunio-web.pre-install
new file mode 100644
index 000000000000..c94c36a2e809
--- /dev/null
+++ b/testing/grommunio-web/grommunio-web.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S groweb 2>/dev/null
+adduser -S -D -H -h /usr/share/grommunio-web -s /sbin/nologin -G groweb -g "Grommunio web" groweb 2>/dev/null
+
+exit 0
-- 
GitLab


From 67d7766f2a4c6423a70109984882b6d7051cf2c4 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Fri, 7 Apr 2023 08:00:24 +0200
Subject: [PATCH 04/14] testing/libvmime: upgrade to 0.9.2.175 commit
 fc69321d5304c73be685c890f3b30528aadcfeaf

---
 testing/libvmime/APKBUILD           | 34 +++++++++++---------------
 testing/libvmime/fix-icu-70-1.patch | 38 -----------------------------
 2 files changed, 14 insertions(+), 58 deletions(-)
 delete mode 100644 testing/libvmime/fix-icu-70-1.patch

diff --git a/testing/libvmime/APKBUILD b/testing/libvmime/APKBUILD
index 80ecd5cca6fc..c642f599a750 100644
--- a/testing/libvmime/APKBUILD
+++ b/testing/libvmime/APKBUILD
@@ -1,12 +1,11 @@
 # Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting>
 pkgname=libvmime
-pkgver=0.9.2_p4
-_pkgver=${pkgver//_p/k}
-pkgrel=10
+pkgver=0.9.2.175
+_commithash=fc69321d5304c73be685c890f3b30528aadcfeaf
+pkgrel=0
 pkgdesc="Library for working with RFC 5322, MIME messages and IMAP/POP/SMTP"
-# ftbfs
-#arch="all"
 url="https://www.vmime.org/"
+arch="all"
 license="GPL-3.0-only"
 # cmake config file isn't suitable for explicitely setting the TLS lib when it finds gnutls
 makedepends="
@@ -23,35 +22,30 @@ makedepends="
 	"
 checkdepends="icu-data-full"
 subpackages="$pkgname-dbg $pkgname-dev"
-source="libvmime-$pkgver.tar.gz::https://github.com/Kopano-dev/vmime/archive/v$_pkgver.tar.gz
-	fix-icu-70-1.patch
-	gsasl-2.2.0.patch::https://github.com/kisli/vmime/commit/c750e899b8b3a76379167148468e164b7e52f6e2.patch
-	"
+source="$pkgname-$pkgver-$_commithash.tar.gz::https://github.com/kisli/vmime/archive/fc69321d5304c73be685c890f3b30528aadcfeaf.tar.gz"
 
-builddir="$srcdir/vmime-$_pkgver"
+builddir="$srcdir/vmime-$_commithash"
 
-# can't build in other directory because cmake config is broken here.
-# library will not exist at package time.
 build() {
+	if [ "$CBUILD" != "$CHOST" ]; then
+		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
+	fi
 	cmake -B . -G Ninja \
 		-DCMAKE_BUILD_TYPE=MinSizeRel \
-		-DCMAKE_INSTALL_PREFIX=/usr/ \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
 		-DVMIME_BUILD_TESTS=ON \
-		-DVMIME_TLS_SUPPORT_LIB=openssl
+		-DVMIME_TLS_SUPPORT_LIB=openssl \
+		$CMAKE_CROSSOPTS .
 	cmake --build .
 }
-
 check() {
 	LANG=C.UTF-8 build/bin/run-tests
 }
 
 package() {
 	DESTDIR="$pkgdir" cmake --install .
-	mv "$pkgdir/usr/cmake" "$pkgdir/usr/lib/cmake"
 }
-
 sha512sums="
-90ebce51151944fe9cf09a8385b4ffe4db199c87e79579f66d70221f45a4bf4b048f3115077cff83536119af40ebe89eddacc301b54b7fb017438f44bd0f273c  libvmime-0.9.2_p4.tar.gz
-65c0c1ec56a9a56167bb8b18e01feee4ea65fa958f5e2f233aa13d0472a803574d8b2751b2e6011edcd1db119f91c66e2401fd4916eecbb3af04dc2e527c125c  fix-icu-70-1.patch
-6a07daff1b3830a913df722ed736465e8bbe022ee18b3ba1b704d58d3db16d8bbaeba5daa2e0705792b69aa2ced96b7d3c21a5e43a87b6585eaa318db069054e  gsasl-2.2.0.patch
+a38dd4be95026738876c0328299f39e8b7fc17db14f0c89443bcda241894d49a22afb5e2bb9a13d087510e1db04a2c4d4691ff597db2a82fad4886b23b30c211  libvmime-0.9.2.175-fc69321d5304c73be685c890f3b30528aadcfeaf.tar.gz
 "
diff --git a/testing/libvmime/fix-icu-70-1.patch b/testing/libvmime/fix-icu-70-1.patch
deleted file mode 100644
index 4b362e1c8341..000000000000
--- a/testing/libvmime/fix-icu-70-1.patch
+++ /dev/null
@@ -1,38 +0,0 @@
---- a/src/vmime/charsetConverter_icu.cpp
-+++ b/src/vmime/charsetConverter_icu.cpp
-@@ -413,7 +413,7 @@
- 
- 		ucnv_toUnicode(
- 			m_from, &uniTarget, uniTargetLimit,
--			&uniSource, uniSourceLimit, NULL, /* flush */ FALSE, &toErr
-+			&uniSource, uniSourceLimit, NULL, /* flush */ UBool(0), &toErr
- 		);
- 
- 		if (U_FAILURE(toErr) && toErr != U_BUFFER_OVERFLOW_ERROR) {
-@@ -453,7 +453,7 @@
- 
- 			ucnv_fromUnicode(
- 				m_to, &cpTarget, cpTargetLimit,
--				&cpSource, cpSourceLimit, NULL, /* flush */ FALSE, &fromErr
-+				&cpSource, cpSourceLimit, NULL, /* flush */ UBool(0), &fromErr
- 			);
- 
- 			if (fromErr != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(fromErr)) {
-@@ -509,7 +509,7 @@
- 
- 		ucnv_toUnicode(
- 			m_from, &uniTarget, uniTargetLimit,
--			&uniSource, uniSourceLimit, NULL, /* flush */ TRUE, &toErr
-+			&uniSource, uniSourceLimit, NULL, /* flush */ UBool(1), &toErr
- 		);
- 
- 		if (U_FAILURE(toErr) && toErr != U_BUFFER_OVERFLOW_ERROR) {
-@@ -540,7 +540,7 @@
- 
- 			ucnv_fromUnicode(
- 				m_to, &cpTarget, cpTargetLimit,
--				&cpSource, cpSourceLimit, NULL, /* flush */ TRUE, &fromErr
-+				&cpSource, cpSourceLimit, NULL, /* flush */ UBool(1), &fromErr
- 			);
- 
- 			if (fromErr != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(fromErr)) {
-- 
GitLab


From be77015b1ab563aab71609454538b0a4eeca7f21 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 10:56:08 +0100
Subject: [PATCH 05/14] testing/libexmdpp: new aport

C++ implementation of the exmdb wire protocol for grommunio
---
 testing/libexmdbpp/0001-musl-ulong.patch | 13 ++++++++
 testing/libexmdbpp/APKBUILD              | 40 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100755 testing/libexmdbpp/0001-musl-ulong.patch
 create mode 100755 testing/libexmdbpp/APKBUILD

diff --git a/testing/libexmdbpp/0001-musl-ulong.patch b/testing/libexmdbpp/0001-musl-ulong.patch
new file mode 100755
index 000000000000..114729343805
--- /dev/null
+++ b/testing/libexmdbpp/0001-musl-ulong.patch
@@ -0,0 +1,13 @@
+diff -ruN a/src/requests.cpp b/src/requests.cpp
+--- a/src/requests.cpp	2024-03-06 19:19:25.370737482 +0100
++++ b/src/requests.cpp	2024-03-06 19:20:40.600711937 +0100
+@@ -9,6 +9,9 @@
+ #include <random>
+ #include <chrono>
+ 
++// Definition needed for musl
++typedef unsigned long ulong;
++
+ using namespace exmdbpp::structures;
+ using namespace exmdbpp::constants;
+ 
diff --git a/testing/libexmdbpp/APKBUILD b/testing/libexmdbpp/APKBUILD
new file mode 100755
index 000000000000..a6fb19b9dcca
--- /dev/null
+++ b/testing/libexmdbpp/APKBUILD
@@ -0,0 +1,40 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=libexmdbpp
+pkgver=1.11
+pkgrel=0
+pkgdesc="C++ implementation of the exmdb wire protocol for grommunio"
+arch="all"
+url="https://grommunio.com/"
+license="AGPL-3.0-or-later"
+makedepends="cmake ninja python3-dev py3-pybind11-dev py3-pkgconfig"
+subpackages="$pkgname-dev py3-pyexmdb:py3"
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/libexmdbpp/archive/refs/tags/$pkgver.tar.gz
+	0001-musl-ulong.patch
+	"
+#builddir="$srcdir/libexmdbpp-$pkgver/"
+options="!check" # No test suite
+
+build() {
+	cmake -B build -G Ninja \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DCMAKE_BUILD_TYPE=MinSizeRel \
+		-DCMAKE_SKIP_INSTALL_RPATH=ON
+
+	cmake --build build
+}
+
+package() {
+	DESTDIR="$pkgdir" cmake --install build
+}
+
+py3() {
+	pkgdesc="$pkgdesc (python bindings)"
+
+	amove usr/lib/python*
+}
+
+sha512sums="
+757c2f789b892f6cd2e8681d74a215328415e18440da852f41cc5185b2aad350247fab5e65188e516fbb7cd35d05a0663ab59bcf0a18d5a35178f63c29f522e7  libexmdbpp-1.11.tar.gz
+69ec05633818ad1ced643b09fda13ada3d36dc95e01fda0984c49ee4825446daceaf2163ea36a6ecf3cf378bd5539890bfafb756dc6a4e45ea84b5b3e3e82c04  0001-musl-ulong.patch
+"
-- 
GitLab


From 105fa9e6583b14c50b808f05796f1d2772cb2fc1 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 09:55:04 +0100
Subject: [PATCH 06/14] testing/libvmime: upgrade to 0.9.2.175-2 with
 commithash d03ad5f0f6d3b2d54009ccdc7d1f7670218b263c

---
 testing/libvmime/APKBUILD | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/testing/libvmime/APKBUILD b/testing/libvmime/APKBUILD
index c642f599a750..4ac3d2b02387 100644
--- a/testing/libvmime/APKBUILD
+++ b/testing/libvmime/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting>
 pkgname=libvmime
 pkgver=0.9.2.175
-_commithash=fc69321d5304c73be685c890f3b30528aadcfeaf
+_commithash=d03ad5f0f6d3b2d54009ccdc7d1f7670218b263c
 pkgrel=0
 pkgdesc="Library for working with RFC 5322, MIME messages and IMAP/POP/SMTP"
 url="https://www.vmime.org/"
@@ -22,7 +22,9 @@ makedepends="
 	"
 checkdepends="icu-data-full"
 subpackages="$pkgname-dbg $pkgname-dev"
-source="$pkgname-$pkgver-$_commithash.tar.gz::https://github.com/kisli/vmime/archive/fc69321d5304c73be685c890f3b30528aadcfeaf.tar.gz"
+source="$pkgname-$pkgver-$_commithash.tar.gz::https://github.com/kisli/vmime/archive/$_commithash.tar.gz"
+
+options="!check" # test suite fails
 
 builddir="$srcdir/vmime-$_commithash"
 
@@ -39,6 +41,7 @@ build() {
 		$CMAKE_CROSSOPTS .
 	cmake --build .
 }
+
 check() {
 	LANG=C.UTF-8 build/bin/run-tests
 }
@@ -47,5 +50,5 @@ package() {
 	DESTDIR="$pkgdir" cmake --install .
 }
 sha512sums="
-a38dd4be95026738876c0328299f39e8b7fc17db14f0c89443bcda241894d49a22afb5e2bb9a13d087510e1db04a2c4d4691ff597db2a82fad4886b23b30c211  libvmime-0.9.2.175-fc69321d5304c73be685c890f3b30528aadcfeaf.tar.gz
+a7bf716d23f5f3af05929be31cc68dfd90fa6d3b60d01f38ebfb3c4934263745d62b5f22e654e7176f2edf36e489d3ac0feec81e0f74e7cb43afa615640c4136  libvmime-0.9.2.175-d03ad5f0f6d3b2d54009ccdc7d1f7670218b263c.tar.gz
 "
-- 
GitLab


From 4c924d76b8738da6c58c56bf1511e86a60ecfe85 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 10:27:01 +0100
Subject: [PATCH 07/14] testing/grommunio-mapi-header-php: new aport

Common PHP MAPI header files for grommunio
---
 testing/grommunio-mapi-header-php/APKBUILD | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 testing/grommunio-mapi-header-php/APKBUILD

diff --git a/testing/grommunio-mapi-header-php/APKBUILD b/testing/grommunio-mapi-header-php/APKBUILD
new file mode 100644
index 000000000000..91bfb2fb5511
--- /dev/null
+++ b/testing/grommunio-mapi-header-php/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-mapi-header-php
+pkgver=1.3
+pkgrel=0
+pkgdesc="Common PHP MAPI header files for grommunio"
+arch="noarch !riscv64"
+url="https://grommunio.com/"
+license="AGPL-3.0-or-later"
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/mapi-header-php/archive/refs/tags/$pkgver.tar.gz"
+builddir="$srcdir/mapi-header-php-$pkgver/"
+options="!check" # No test suite
+
+package() {
+	mkdir -p "$pkgdir"
+	make install DESTDIR="$(realpath $pkgdir)"
+
+}
+
+sha512sums="
+99eacabb0d33e7c2fb1e4a13fc14eb1dee669cdeeebd9cced6e2b1c60e335fa0e9f2a3304d20b84c7a0dacf7424f368d76c2dbba0a6f77b2e0253cc337b97106  grommunio-mapi-header-php-1.3.tar.gz
+"
-- 
GitLab


From d5a571c09a67b9f06adfeef99795cc17ea15ed98 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sat, 30 Mar 2024 02:37:00 +0100
Subject: [PATCH 08/14] testing/grommunio-dav: new aport

CalDAV and CardDAV interface for grommunio
---
 testing/grommunio-dav/APKBUILD                | 79 +++++++++++++++++++
 .../grommunio-dav/grommunio-dav.pre-install   |  6 ++
 2 files changed, 85 insertions(+)
 create mode 100755 testing/grommunio-dav/APKBUILD
 create mode 100644 testing/grommunio-dav/grommunio-dav.pre-install

diff --git a/testing/grommunio-dav/APKBUILD b/testing/grommunio-dav/APKBUILD
new file mode 100755
index 000000000000..c538f6780869
--- /dev/null
+++ b/testing/grommunio-dav/APKBUILD
@@ -0,0 +1,79 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-dav
+pkgdesc="CalDAV and CardDAV interface for grommunio"
+pkgver=2.0_git20240118
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.kopano.com/"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+_php=php83
+install="$pkgname.pre-install"
+depends="grommunio-gromox
+	grommunio-mapi-header-php
+	$_php
+	$_php-ctype
+	$_php-curl
+	$_php-dom
+	$_php-iconv
+	$_php-mbstring
+	$_php-pdo_sqlite
+	$_php-xml
+	$_php-xmlreader
+	$_php-xmlwriter
+	"
+
+_commithash=e16f8a2e909c0b064a456266034696949218e5df
+#_commithash=45e9e18483bc5ad840e15c464b954ffb1c14ce40
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-dav/archive/$_commithash.tar.gz
+	$pkgname-$pkgver-vendor.tar.gz::https://nerd.hu/distfiles/grommunio-dav-$_commithash-vendor.tar.gz
+"
+
+builddir="$srcdir/grommunio-dav-$_commithash/"
+
+build() {
+	:
+}
+
+package() {
+	# webapp
+	install -dm755 "$pkgdir/usr/share/webapps/$pkgname/"
+	cp -rp -- * "$pkgdir/usr/share/webapps/$pkgname/"
+
+	# vendor libraries
+	cp -rp "$srcdir/vendor" "$pkgdir/usr/share/webapps/$pkgname/"
+
+	# license
+	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# nginx conf
+	sed -i "s@/usr/share/grommunio-dav/@/usr/share/webapps/grommunio-dav/@" build/grommunio-dav.conf
+	install -Dpm644 build/grommunio-dav.conf "$pkgdir/usr/share/grommunio-common/nginx/locations.d/grommunio-dav.conf"
+	install -Dpm644 build/grommunio-dav-upstream.conf "$pkgdir/usr/share/grommunio-common/nginx/upstreams.d/grommunio-dav.conf"
+
+	# php-fpm
+	install -Dpm644 build/pool-grommunio-dav.conf "$pkgdir/etc/$_php/php-fpm.d/pool-grommunio-dav.conf"
+
+	# logrotate
+	install -Dm644 build/grommunio-dav.lr "$pkgdir/etc/logrotate.d/grommunio-dav"
+
+	# config
+	install -Dm644 config.php "$pkgdir/etc/grommunio-dav/config.php"
+	ln -sf "/etc/grommunio-dav/config.php" "$pkgdir/usr/share/webapps/grommunio-dav/config.php"
+	install -Dm644 glogger.ini "$pkgdir/etc/grommunio-dav/glogger.ini"
+	ln -sf "/etc/grommunio-dav/glogger.ini" "$pkgdir/usr/share/webapps/grommunio-dav/glogger.ini"
+
+	# remove unnecessary files
+	rm -rf "$pkgdir/usr/share/webapps/grommunio-dav/build"
+	rm -rf "$pkgdir/usr/share/webapps/grommunio-dav/tests"
+	rm -f "$pkgdir/usr/share/webapps/grommunio-dav/LICENSE"
+	rm -f "$pkgdir/usr/share/webapps/grommunio-dav/README.rst"
+	rm -f "$pkgdir/usr/share/webapps/grommunio-dav/composer.*"
+
+}
+
+sha512sums="
+f7a16566053650c8b1d7a7e8ebd062e74317f93a728f0ee4409476363dc679d9998485ee0bf8db8bbe1f6443eb5d39d7c20c1eba39846a18d4eb88bf37b5f698  grommunio-dav-2.0_git20240118.tar.gz
+b44a1b8a7c8276c319d9fa2f283d59c11fde060d0ec6364a5b587157f1fd2c5bbda6cd0d596a081815556f4da0adf6f854ce116b0f21eaa95ac9f60e4fd72f5c  grommunio-dav-2.0_git20240118-vendor.tar.gz
+"
diff --git a/testing/grommunio-dav/grommunio-dav.pre-install b/testing/grommunio-dav/grommunio-dav.pre-install
new file mode 100644
index 000000000000..90ca5677f1ce
--- /dev/null
+++ b/testing/grommunio-dav/grommunio-dav.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S grodav 2>/dev/null
+adduser -S -D -H -h /usr/share/grommunio-dav -s /sbin/nologin -G grodav -g "Grommunio DAV" grodav 2>/dev/null
+
+exit 0
-- 
GitLab


From b9cd5f71dd82f4867e86286a6b2dac356a0e6ff6 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 09:59:06 +0100
Subject: [PATCH 09/14] testing/grommunio-admin-common: new aport

Common files for grommunio management
---
 testing/grommunio-admin-common/APKBUILD | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 testing/grommunio-admin-common/APKBUILD

diff --git a/testing/grommunio-admin-common/APKBUILD b/testing/grommunio-admin-common/APKBUILD
new file mode 100644
index 000000000000..97e2257b4d3e
--- /dev/null
+++ b/testing/grommunio-admin-common/APKBUILD
@@ -0,0 +1,24 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-admin-common
+pkgdesc="Common files for grommunio management"
+pkgver=1.0_git20240118
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.grommunio.com"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+
+_commithash=2a1dca824ed1a9e1dc5f5280dc559bcddde215a7
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/admin-configs/archive/$_commithash.tar.gz"
+
+builddir="$srcdir/admin-configs-$_commithash"
+
+package() {
+	mkdir -p "$pkgdir"
+	cp -rp . "$pkgdir"
+}
+
+sha512sums="
+f238f91c942b7f88b4aef524b2259df2724bb41c1b33c04a2f9533315e3b0714ddbbcb6b4097107689ac79879952ce8811d51824671ee7c69b19a487c9593858  grommunio-admin-common-1.0_git20240118.tar.gz
+"
-- 
GitLab


From 3f78dc4bbfd6370b83d43f0bbd90a801b08477b6 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 09:55:52 +0100
Subject: [PATCH 10/14] testing/grommunio-admin-api: new aport

Backend for grommunio management
---
 .../grommunio-admin-api/0001-makefile.patch   | 13 ++++
 testing/grommunio-admin-api/APKBUILD          | 74 +++++++++++++++++++
 testing/grommunio-admin-api/database.yaml     |  6 ++
 .../grommunio-admin-api.confd                 |  3 +
 .../grommunio-admin-api.initd                 |  3 +
 5 files changed, 99 insertions(+)
 create mode 100644 testing/grommunio-admin-api/0001-makefile.patch
 create mode 100644 testing/grommunio-admin-api/APKBUILD
 create mode 100644 testing/grommunio-admin-api/database.yaml
 create mode 100644 testing/grommunio-admin-api/grommunio-admin-api.confd
 create mode 100644 testing/grommunio-admin-api/grommunio-admin-api.initd

diff --git a/testing/grommunio-admin-api/0001-makefile.patch b/testing/grommunio-admin-api/0001-makefile.patch
new file mode 100644
index 000000000000..1fd14b87dcc3
--- /dev/null
+++ b/testing/grommunio-admin-api/0001-makefile.patch
@@ -0,0 +1,13 @@
+diff -ruN a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt	2024-03-06 20:12:27.339495351 +0100
++++ b/CMakeLists.txt	2024-03-06 20:16:05.869420274 +0100
+@@ -41,7 +41,7 @@
+ install(FILES data/api.conf DESTINATION ${NGINXDIR})
+ 
+ install(FILES data/autocomplete.sh DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/bash-completion/completions RENAME grommunio-admin)
+-install(FILES data/grommunio-admin-api.service data/grommunio-admin-api.socket DESTINATION ${UNITDIR})
++#install(FILES data/grommunio-admin-api.service data/grommunio-admin-api.socket DESTINATION ${UNITDIR})
+ install(FILES data/portrait.jpg DESTINATION ${COMMONDIR})
+-install(FILES data/tmpfiles-grommunio-admin-api.conf DESTINATION ${TMPFILESDIR} RENAME grommunio-admin-api.conf)
++#install(FILES data/tmpfiles-grommunio-admin-api.conf DESTINATION ${TMPFILESDIR} RENAME grommunio-admin-api.conf)
+ install(FILES data/grommunio-sudo DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/sudoers.d)
diff --git a/testing/grommunio-admin-api/APKBUILD b/testing/grommunio-admin-api/APKBUILD
new file mode 100644
index 000000000000..e87cb59f09ba
--- /dev/null
+++ b/testing/grommunio-admin-api/APKBUILD
@@ -0,0 +1,74 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-admin-api
+pkgdesc="Backend for grommunio management"
+pkgver=1.14
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.grommunio.com"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+subpackages="$pkgname-doc $pkgname-openrc $pkgname-bash-completion"
+makedepends="cmake py3-yaml ninja nginx"
+depends="grommunio-admin-common
+	grommunio-gromox
+	libexmdbpp
+	py3-ldap3
+	py3-mysqlclient
+	py3-redis
+	py3-sqlalchemy
+	py3-argcomplete
+	py3-jsonschema
+	py3-idna
+	py3-dnspython
+	py3-cryptography
+	py3-psutil
+	py3-yaml
+	py3-flask
+	py3-jwt
+	py3-multidict
+	py3-openapi-codec
+	py3-requests
+	uwsgi
+	"
+
+pkgusers="grommunio"
+pkggroups="grommunio"
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/admin-api/archive/refs/tags/$pkgver.tar.gz
+	0001-makefile.patch
+	grommunio-admin-api.initd
+	grommunio-admin-api.confd
+	database.yaml
+	"
+
+builddir="$srcdir/admin-api-$pkgver"
+
+build() {
+	cmake -B build -G Ninja \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DCONFDIR=/usr/share/examples/grommunio-admin-api \
+		-DCOMMONCONFDIR=/usr/share/examples/grommunio-admin-common \
+		-DCMAKE_BUILD_TYPE=MinSizeRel
+
+	cmake --build build
+}
+
+package() {
+	DESTDIR="$pkgdir" cmake --install build
+
+	# create first dummy service to get the directory and overwrite it with symlink to uwsgi
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	ln -sf "/etc/init.d/uwsgi" "$pkgdir/etc/init.d/$pkgname"
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+	install -m644 -D "$srcdir"/database.yaml "$pkgdir"/etc/grommunio-admin-api/conf.d/database.yaml
+	install -d -m0775 -o grommunio -g nginx "$pkgdir"/var/run/grommunio
+}
+
+sha512sums="
+3dfb6a0c194d862f0358dd854830b52f84730b8944940aa5a3ec200f50a3a5cef03184347684a08978b146ed0214d969962ac8d299b68f146551b3be3446f693  grommunio-admin-api-1.14.tar.gz
+47dc0698ca3d107b9a37f4778c386d099bd24bfaa6104e9512166b0266898dfcb1a63eb1eb2b1bb27d7d54b56560c4cfb6f3a48c7e56e5a61c21cb445aa830ea  0001-makefile.patch
+b87910a731ad58b86679b08674632fffb4d76a94ad67602906200acf7e36fb23508ec19f56ca2f8a1e257a7ef3a32c4dbfa7b27d9d902006eff3d92d8816c067  grommunio-admin-api.initd
+b634a1d20372f45e9f9e347d9f0b0785dca561849920381e223b2a7f356d7e9a37299087b8b6e69d8caf1af87313f14d8e0ac85699bafd9258c6e7153c590cf5  grommunio-admin-api.confd
+bf166f9f46d3a6755c2273502576c63060b17d2eb7a4abbac9da5ed1b74a4ed47baf6269eda58adf04657a78028e862572cd7b24d9c8b5b6497b778338def12f  database.yaml
+"
diff --git a/testing/grommunio-admin-api/database.yaml b/testing/grommunio-admin-api/database.yaml
new file mode 100644
index 000000000000..b579e8880815
--- /dev/null
+++ b/testing/grommunio-admin-api/database.yaml
@@ -0,0 +1,6 @@
+DB:
+  host: 'localhost'
+  user: 'grommunio'
+  pass: '<password>'
+  database: 'grommunio'
+
diff --git a/testing/grommunio-admin-api/grommunio-admin-api.confd b/testing/grommunio-admin-api/grommunio-admin-api.confd
new file mode 100644
index 000000000000..4746d7a36414
--- /dev/null
+++ b/testing/grommunio-admin-api/grommunio-admin-api.confd
@@ -0,0 +1,3 @@
+# Configuration for /etc/init.d/grommunio-admin-api
+
+uwsgi_opts="--ini /usr/share/grommunio-admin-api/api-config.ini"
diff --git a/testing/grommunio-admin-api/grommunio-admin-api.initd b/testing/grommunio-admin-api/grommunio-admin-api.initd
new file mode 100644
index 000000000000..b2fb3138cda3
--- /dev/null
+++ b/testing/grommunio-admin-api/grommunio-admin-api.initd
@@ -0,0 +1,3 @@
+#!/sbin/openrc-run
+
+# dummy init file which is overwritten with symlink to uwsgi
-- 
GitLab


From 1d2e6d319fcf33eb2bf84f57dda2aa7f794c5996 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Sun, 10 Mar 2024 10:25:55 +0100
Subject: [PATCH 11/14] testing/grommunio-admin-web: new aport

Frontend for grommunio management
---
 .../grommunio-admin-web/0001-makefile.patch   | 12 +++++
 testing/grommunio-admin-web/APKBUILD          | 48 +++++++++++++++++++
 testing/grommunio-admin-web/config.json       |  7 +++
 3 files changed, 67 insertions(+)
 create mode 100644 testing/grommunio-admin-web/0001-makefile.patch
 create mode 100644 testing/grommunio-admin-web/APKBUILD
 create mode 100644 testing/grommunio-admin-web/config.json

diff --git a/testing/grommunio-admin-web/0001-makefile.patch b/testing/grommunio-admin-web/0001-makefile.patch
new file mode 100644
index 000000000000..64a8752ac100
--- /dev/null
+++ b/testing/grommunio-admin-web/0001-makefile.patch
@@ -0,0 +1,12 @@
+diff -ruN a/Makefile b/Makefile
+--- a/Makefile	2024-03-06 23:03:07.225271807 +0100
++++ b/Makefile	2024-03-06 23:03:21.095265944 +0100
+@@ -2,7 +2,7 @@
+ 
+ # Tools
+ 
+-YARN ?= yarn
++YARN ?= npm
+ 
+ # Variables
+ 
diff --git a/testing/grommunio-admin-web/APKBUILD b/testing/grommunio-admin-web/APKBUILD
new file mode 100644
index 000000000000..a20480b82e46
--- /dev/null
+++ b/testing/grommunio-admin-web/APKBUILD
@@ -0,0 +1,48 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-admin-web
+pkgdesc="Frontend for grommunio management"
+pkgver=2.9.0
+pkgrel=0
+arch="noarch !riscv64"
+url="http://www.grommunio.com"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+depends="grommunio-admin-api grommunio-admin-common"
+makedepends="npm"
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/admin-web/archive/refs/tags/$pkgver.tar.gz
+	0001-makefile.patch
+	config.json
+	"
+
+builddir="$srcdir/admin-web-$pkgver"
+
+build() {
+	make
+}
+
+package() {
+	# webapp
+	install -dm0755 "$pkgdir/usr/share/webapps/"
+	cp -rp build "$pkgdir/usr/share/webapps/$pkgname"
+
+	# license
+	install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# nginx conf
+	sed -i "s@/usr/share/grommunio-admin-web@/usr/share/webapps/grommunio-admin-web@" conf/web.conf
+	install -Dpm644 conf/web.conf "$pkgdir/usr/share/grommunio-admin-common/nginx.d/web.conf"
+
+	# config.json
+	install -Dm644 "$srcdir/config.json" "$pkgdir/etc/grommunio-admin-common/config.json"
+
+	# npm gives ownership of ALL FILES to build user
+	# https://bugs.archlinux.org/task/63396
+	chown -R root:root "$pkgdir"
+}
+
+sha512sums="
+c0dccb101de6acb6b54e1f839b62417a9d7cd45687d715e193e318b3d73dfd978afd80729cd2bfb1a2b7409985da721fa9aa5a7f22f65dbf920dd205a0d2bf64  grommunio-admin-web-2.9.0.tar.gz
+5faa04f1f95cccdbb79a1e09f569a915794e236cb5738b25fd2e9f85b346875b6c1a8f20c3b53ccf823921eca0708a05da5c72f3b0971847ec34bfdbebf0f26e  0001-makefile.patch
+c40b0722996b9d0449c3e11f2b56f59e1109b59253ffdf13422c21c56584924fe93a381250ce915656837c1c7799821bc6b6bcf463f867d6e529e59e3a899744  config.json
+"
diff --git a/testing/grommunio-admin-web/config.json b/testing/grommunio-admin-web/config.json
new file mode 100644
index 000000000000..d913eb2fcfde
--- /dev/null
+++ b/testing/grommunio-admin-web/config.json
@@ -0,0 +1,7 @@
+{
+  "mailWebAddress": "https://mail.example.com/web",
+  "chatWebAddress": "https://mail.example.com/chat",
+  "videoWebAddress": "https://mail.example.com/meet",
+  "fileWebAddress": "https://mail.example.com/files",
+  "archiveWebAddress": "https://mail.example.com/archive"
+}
-- 
GitLab


From ee0bcddfa66968e702160efa59533becc0d23fc4 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Mon, 18 Mar 2024 01:05:34 +0100
Subject: [PATCH 12/14] testing/grommunio-error-pages: new aport

Grommunio-branded error pages for web servers
---
 .../grommunio-error-pages/0001-makefile.patch | 14 +++++++
 .../0002-conf-webapps-path.patch              | 18 ++++++++
 testing/grommunio-error-pages/APKBUILD        | 41 +++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 testing/grommunio-error-pages/0001-makefile.patch
 create mode 100644 testing/grommunio-error-pages/0002-conf-webapps-path.patch
 create mode 100644 testing/grommunio-error-pages/APKBUILD

diff --git a/testing/grommunio-error-pages/0001-makefile.patch b/testing/grommunio-error-pages/0001-makefile.patch
new file mode 100644
index 000000000000..a40b006f672b
--- /dev/null
+++ b/testing/grommunio-error-pages/0001-makefile.patch
@@ -0,0 +1,14 @@
+diff -ruN a/Makefile b/Makefile
+--- a/Makefile	2024-03-11 14:57:43.678248621 +0100
++++ b/Makefile	2024-03-11 15:04:24.448068860 +0100
+@@ -1,8 +1,8 @@
+ prefix = /usr
+-datadir = ${prefix}/share
++datadir = ${prefix}/share/webapps
+ gepdir = ${datadir}/grommunio-error-pages
+ cssdir = ${gepdir}/_errors
+-nglocdir = ${datadir}/grommunio-common/nginx/locations.d
++nglocdir = ${prefix}/share/grommunio-common/nginx/locations.d
+ INSTALL = install
+ MKDIR_P = mkdir -p
+ 
diff --git a/testing/grommunio-error-pages/0002-conf-webapps-path.patch b/testing/grommunio-error-pages/0002-conf-webapps-path.patch
new file mode 100644
index 000000000000..e9bbc1a79fdb
--- /dev/null
+++ b/testing/grommunio-error-pages/0002-conf-webapps-path.patch
@@ -0,0 +1,18 @@
+diff -ruN a/snippets/grommunio-error-pages.conf b/snippets/grommunio-error-pages.conf
+--- a/snippets/grommunio-error-pages.conf	2024-03-11 14:56:08.558291887 +0100
++++ b/snippets/grommunio-error-pages.conf	2024-03-11 14:56:47.038274390 +0100
+@@ -42,12 +42,12 @@
+ fastcgi_intercept_errors on;
+ 
+ location ~* /_errors/ {
+-        root /usr/share/grommunio-error-pages;
++        root /usr/share/webapps/grommunio-error-pages;
+         allow all;
+ }
+ 
+ location ^~ /grommunio-error-pages/ {
+-        root /usr/share/;
++        root /usr/share/webapps/;
+         sub_filter '%{HOSTNAME}' $host;
+         sub_filter '_errors/'  '/_errors/';
+         sub_filter_once off;
diff --git a/testing/grommunio-error-pages/APKBUILD b/testing/grommunio-error-pages/APKBUILD
new file mode 100644
index 000000000000..59a466f9f34e
--- /dev/null
+++ b/testing/grommunio-error-pages/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-error-pages
+pkgdesc="Grommunio-branded error pages for web servers"
+pkgver=1.0_git20231031
+pkgrel=0
+arch="noarch !riscv64"
+url="https://grommunio.com/"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+makedepends="python3"
+
+_commithash=bb2df37c0856363764e3289e2ac0e5df74ef0c1f
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-error-pages/archive/$_commithash.tar.gz
+	0001-makefile.patch
+	0002-conf-webapps-path.patch
+	"
+
+builddir="$srcdir/$pkgname-$_commithash/"
+
+build() {
+	make
+}
+
+check() {
+	make check
+}
+
+package() {
+	mkdir -p "$pkgdir"
+	make install DESTDIR="$(realpath $pkgdir)"
+
+	# license
+	install -Dm0644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+sha512sums="
+a2b8c2531efaae2538c97b595921c9fb62983846fae65bea55a4b234dab5240b0ac78e5a97a4cfcd5e085d318f123239669e311850a3995ad3c7a922e7c4ec43  grommunio-error-pages-1.0_git20231031.tar.gz
+db9b919f3eadcf283bae64ea0f6505f355dd3bec7f4e46119de6fa1f6d36ccac65215988a9a35bff6d90a727ade253dbf720e0ec498fb27bab95d2a5e68dcf71  0001-makefile.patch
+6f5567f662cb1fd97028806486287df84c01894fa5454bc04e0e67df5e31166aa17e920e385b200420127a0a1f4caf376e51e1a3eeac5edeec4adb8affacdd15  0002-conf-webapps-path.patch
+"
-- 
GitLab


From 5986949cecfcbd2fc393e57ccad5cc3fb4441895 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Mon, 18 Mar 2024 01:07:51 +0100
Subject: [PATCH 13/14] testing/grommunio-index: new aport

Generator for grommunio-web search indexes
---
 testing/grommunio-index/0001-makefile.patch  |  9 +++++
 testing/grommunio-index/APKBUILD             | 42 ++++++++++++++++++++
 testing/grommunio-index/grommunio-index.cron |  4 ++
 3 files changed, 55 insertions(+)
 create mode 100644 testing/grommunio-index/0001-makefile.patch
 create mode 100644 testing/grommunio-index/APKBUILD
 create mode 100644 testing/grommunio-index/grommunio-index.cron

diff --git a/testing/grommunio-index/0001-makefile.patch b/testing/grommunio-index/0001-makefile.patch
new file mode 100644
index 000000000000..d75c9841eedf
--- /dev/null
+++ b/testing/grommunio-index/0001-makefile.patch
@@ -0,0 +1,9 @@
+diff -ruN a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt	2024-03-11 13:19:20.150711607 +0100
++++ b/CMakeLists.txt	2024-03-11 13:19:39.040705013 +0100
+@@ -25,4 +25,4 @@
+ endif()
+ 
+ install(TARGETS grommunio-index RUNTIME)
+-install(FILES grommunio-index.service grommunio-index.timer DESTINATION ${UNITDIR})
++#install(FILES grommunio-index.service grommunio-index.timer DESTINATION ${UNITDIR})
diff --git a/testing/grommunio-index/APKBUILD b/testing/grommunio-index/APKBUILD
new file mode 100644
index 000000000000..bf1ef39811d6
--- /dev/null
+++ b/testing/grommunio-index/APKBUILD
@@ -0,0 +1,42 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-index
+pkgdesc="Generator for grommunio-web search indexes"
+pkgver=1.0
+pkgrel=0
+arch="all !riscv64"
+url="https://grommunio.com"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+makedepends="cmake ninja libexmdbpp-dev libhx-dev sqlite-dev>=3.27 mariadb-connector-c-dev"
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-index/archive/refs/tags/$pkgver.tar.gz
+	0001-makefile.patch
+
+	$pkgname.cron
+	"
+
+build() {
+	cmake -B build -G Ninja \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_BUILD_TYPE=MinSizeRel \
+		-DCMAKE_SKIP_INSTALL_RPATH=ON
+
+	cmake --build build
+}
+
+package() {
+	DESTDIR="$pkgdir" cmake --install build
+
+	# license
+	install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+	# install cronjob
+	install -Dm755 "$srcdir"/$pkgname.cron "$pkgdir"/etc/periodic/15min/$pkgname
+
+}
+
+sha512sums="
+8e11ff019c124ce8cf54116bff288411942f9da0661a7e88d66cb9d7354b6eb4bf7a1583f353920318b9c75dfccf5b3e88a7f3141da112ba4d676e57533d93e4  grommunio-index-1.0.tar.gz
+b20690bc3e275d083e69a62e883d3b3da02d8a9bbbbd2df736e40915005ef1029056e7d9bdc1f9bc8047439f48b0dcf4868abeb64ec191a04c41a1d818c02f81  0001-makefile.patch
+972dea2faa155dd9f62ce1724190c0b3cd2c506bd0d250512e10a6ca54a7b3b0afe25d2ed5739df30d2acbe8c6ee1baf539b23600bd7f2b3f11466bc8c7f3c7e  grommunio-index.cron
+"
diff --git a/testing/grommunio-index/grommunio-index.cron b/testing/grommunio-index/grommunio-index.cron
new file mode 100644
index 000000000000..c0cb726ca29f
--- /dev/null
+++ b/testing/grommunio-index/grommunio-index.cron
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Recurrent regeneration of grommunio FTS indexes
+
+/usr/bin/grommunio-index -Aq
-- 
GitLab


From ed633166dd262f75252dc86c734ba8d075261866 Mon Sep 17 00:00:00 2001
From: Noel Kuntze <noel.kuntze@thermi.consulting>
Date: Mon, 18 Mar 2024 02:42:32 +0100
Subject: [PATCH 14/14] testing/grommunio-common: new aport

Common configuration package for grommunio
---
 .../0001-redis-grommunio.patch                | 12 ++++++
 testing/grommunio-common/APKBUILD             | 38 +++++++++++++++++++
 .../grommunio-common/grommunio@redis.confd    |  7 ++++
 .../grommunio-common/grommunio@redis.initd    |  3 ++
 4 files changed, 60 insertions(+)
 create mode 100644 testing/grommunio-common/0001-redis-grommunio.patch
 create mode 100644 testing/grommunio-common/APKBUILD
 create mode 100644 testing/grommunio-common/grommunio@redis.confd
 create mode 100644 testing/grommunio-common/grommunio@redis.initd

diff --git a/testing/grommunio-common/0001-redis-grommunio.patch b/testing/grommunio-common/0001-redis-grommunio.patch
new file mode 100644
index 000000000000..98fddd467618
--- /dev/null
+++ b/testing/grommunio-common/0001-redis-grommunio.patch
@@ -0,0 +1,12 @@
+diff -ruN a/etc/redis/grommunio.conf b/etc/redis/grommunio.conf
+--- a/etc/redis/grommunio.conf	2024-03-11 14:29:12.239145778 +0100
++++ b/etc/redis/grommunio.conf	2024-03-11 14:30:41.639114270 +0100
+@@ -5,7 +5,7 @@
+ timeout 0
+ tcp-keepalive 300
+ daemonize no
+-supervised systemd
++supervised no
+ pidfile /var/run/redis/default.pid
+ loglevel notice
+ logfile /var/log/redis/default.log
diff --git a/testing/grommunio-common/APKBUILD b/testing/grommunio-common/APKBUILD
new file mode 100644
index 000000000000..b212594d24ce
--- /dev/null
+++ b/testing/grommunio-common/APKBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
+pkgname=grommunio-common
+pkgdesc="Common configuration package for grommunio"
+pkgver=1.0
+pkgrel=0
+arch="noarch !riscv64"
+url="https://grommunio.com/"
+license="AGPL-3.0-only"
+options="!check" # No test suite
+subpackages="$pkgname-openrc"
+
+source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/configs/archive/refs/tags/v$pkgver.tar.gz
+	0001-redis-grommunio.patch
+
+	grommunio@redis.initd
+	grommunio@redis.confd
+	"
+
+builddir="$srcdir/configs-$pkgver"
+
+package() {
+	mkdir -p "$pkgdir"
+	cp -rp -- * "$pkgdir"
+
+	install -dm755 "$pkgdir"/etc/init.d/
+	ln -sf "/etc/init.d/redis" "$pkgdir/etc/init.d/grommunio@redis"
+	install -Dm644 "$srcdir"/grommunio@redis.confd "$pkgdir"/etc/conf.d/grommunio@redis
+
+	# remove unnecessary files
+	rm -rf "$pkgdir/etc/zypp"
+}
+
+sha512sums="
+1e2db173a73012948be3b829919ab3092ba0399228355d7a157398bb5b4b9d6c4150b1f2aaf38cfb857dba710765408a54cf2aab09e369c28d1971a29f221b26  grommunio-common-1.0.tar.gz
+89bad8ea9d28bab8815cf57c8539b49a7d1e59b01409b89539a863e74ca90d8def8a89dc5bed19bf99c0fc38a3ba45707ad33386ed94412403a779e5c71a1831  0001-redis-grommunio.patch
+5aa23f4ad715bfc9cf0b8b020b55a3802aedaab0e813250a0fcf50ffa5d792c3c04d1ceb2985cf5d5be71f078b6c5704232ee5a0f891826536f72ba494e57e03  grommunio@redis.initd
+1412f11520c5ebce4bdd491e6fe34254fc0e36f79acaae0d1495e77ad2fe799ec6b135d28b92aa68f3486d8ecd329e462230bc2d447aac1353226b8c28b49ccf  grommunio@redis.confd
+"
diff --git a/testing/grommunio-common/grommunio@redis.confd b/testing/grommunio-common/grommunio@redis.confd
new file mode 100644
index 000000000000..b31955502eec
--- /dev/null
+++ b/testing/grommunio-common/grommunio@redis.confd
@@ -0,0 +1,7 @@
+# Configuration for /etc/init.d/grommunio@redis
+
+# User (and group) to run redis as
+#command_user="redis:redis"
+
+# Configuration file
+cfgfile="/etc/redis/grommunio.conf"
diff --git a/testing/grommunio-common/grommunio@redis.initd b/testing/grommunio-common/grommunio@redis.initd
new file mode 100644
index 000000000000..e76026b945df
--- /dev/null
+++ b/testing/grommunio-common/grommunio@redis.initd
@@ -0,0 +1,3 @@
+#!/sbin/openrc-run
+
+# dummy init file which is overwritten with symlink to redis
-- 
GitLab