aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Kuntze <noel.kuntze@thermi.consulting>2024-03-30 18:09:08 +0100
committerLeonardo Arena <rnalrd@gmail.com>2024-03-30 17:36:37 +0000
commitd8eb18cdc7bc774ebdbcb789141402a3b547e713 (patch)
treed65ef7070ebed56347dd07fc7020ead5fceebb19
parent9a9e44b959341fa1e0bab9fd08ea6175bb89b788 (diff)
testing/piler: new aport
Open source email archiving solution with all the necessary features for your enterprise
-rw-r--r--testing/piler/0001-utf8_encode_char.patch10
-rw-r--r--testing/piler/0002-manticore-conf.patch17
-rw-r--r--testing/piler/0003-fix_pilerpurge_for_rt_index.patch91
-rw-r--r--testing/piler/APKBUILD114
-rw-r--r--testing/piler/piler-smtp.initd12
-rw-r--r--testing/piler/piler.initd16
-rw-r--r--testing/piler/piler.pre-install6
-rw-r--r--testing/piler/searchd.confd8
-rw-r--r--testing/piler/searchd.initd21
-rw-r--r--testing/xlhtml/APKBUILD3
10 files changed, 297 insertions, 1 deletions
diff --git a/testing/piler/0001-utf8_encode_char.patch b/testing/piler/0001-utf8_encode_char.patch
new file mode 100644
index 00000000000..c6b52188ee5
--- /dev/null
+++ b/testing/piler/0001-utf8_encode_char.patch
@@ -0,0 +1,10 @@
+diff -ruN a/src/decoder.h b/src/decoder.h
+--- a/src/decoder.h 2021-02-23 07:26:47.000000000 +0100
++++ b/src/decoder.h 2022-03-28 18:35:10.706474194 +0200
+@@ -11,5 +11,6 @@
+ void decodeHTML(char *p, int utf8);
+ void decodeURL(char *p);
+ int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding);
++void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len);
+
+ #endif /* _DECODER_H */
diff --git a/testing/piler/0002-manticore-conf.patch b/testing/piler/0002-manticore-conf.patch
new file mode 100644
index 00000000000..8721644ffcb
--- /dev/null
+++ b/testing/piler/0002-manticore-conf.patch
@@ -0,0 +1,17 @@
+diff -ruN a/etc/manticore.conf.in b/etc/manticore.conf.in
+--- a/etc/manticore.conf.in 2024-03-13 09:38:42.847170715 +0100
++++ b/etc/manticore.conf.in 2024-03-13 09:41:24.847111111 +0100
+@@ -248,11 +248,11 @@
+ {
+ listen = 127.0.0.1:9312
+ listen = 127.0.0.1:9306:mysql41
+- log = /var/piler/manticore/manticore.log
++ log = /var/log/piler/manticore.log
+ binlog_max_log_size = 256M
+ binlog_path = /var/piler/manticore
+ binlog_flush = 2
+- query_log = /var/piler/manticore/query.log
++ query_log = /var/log/piler/query.log
+ network_timeout = 5
+ pid_file = /var/run/piler/searchd.pid
+ seamless_rotate = 1
diff --git a/testing/piler/0003-fix_pilerpurge_for_rt_index.patch b/testing/piler/0003-fix_pilerpurge_for_rt_index.patch
new file mode 100644
index 00000000000..66dd1912157
--- /dev/null
+++ b/testing/piler/0003-fix_pilerpurge_for_rt_index.patch
@@ -0,0 +1,91 @@
+From e2f6a718272585dd99737087b9c63fa7a734461c Mon Sep 17 00:00:00 2001
+From: Janos SUTO <sj@acts.hu>
+Date: Wed, 1 Nov 2023 08:25:56 +0100
+Subject: [PATCH] Updated pilerpurge to remove data from manticore in case of
+ RT index
+
+Signed-off-by: Janos SUTO <sj@acts.hu>
+---
+ util/pilerpurge.py | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/util/pilerpurge.py b/util/pilerpurge.py
+index e2e2d61f..dc87916e 100755
+--- a/util/pilerpurge.py
++++ b/util/pilerpurge.py
+@@ -9,7 +9,7 @@ import sys
+ import syslog
+ import time
+
+-SQL_PURGE_SELECT_QUERY = "SELECT piler_id, size FROM " +\
++SQL_PURGE_SELECT_QUERY = "SELECT id, piler_id, size FROM " +\
+ "metadata WHERE deleted=0 AND retained < UNIX_TIMESTAMP(NOW()) " +\
+ "AND id NOT IN (SELECT id FROM rcpt WHERE `to` IN " +\
+ "(SELECT email FROM legal_hold)) AND id NOT IN (SELECT " +\
+@@ -33,7 +33,9 @@ def read_options(filename="", opts={}):
+ opts['password'] = config.get('piler', 'mysqlpwd')
+ opts['database'] = config.get('piler', 'mysqldb')
+ opts['storedir'] = config.get('piler', 'queuedir')
+-
++ opts['rtindex'] = config.getint('piler', 'rtindex', fallback=0)
++ opts['sphxhost'] = config.get('piler', 'sphxhost', fallback='127.0.0.1')
++ opts['sphxport'] = config.getint('piler', 'sphxport', fallback=9306)
+ opts['server_id'] = "%02x" % config.getint('piler', 'server_id')
+
+
+@@ -184,6 +186,17 @@ def get_attachment_file_path(piler_id='', attachment_id=0, opts={}):
+ str(attachment_id)])
+
+
++def purge_index_data(ids=[], opts={}):
++ '''
++ Delete from index data in case of RT index
++ '''
++
++ if opts['rtindex'] == 1 and opts['dry_run'] is False:
++ cursor = opts['sphx'].cursor()
++ a = "," . join([str(x) for x in ids])
++ cursor.execute("DELETE FROM piler WHERE id IN (%s)" % (a))
++
++
+ def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-c", "--config", type=str, help="piler.conf path",
+@@ -203,6 +216,7 @@ def main():
+ opts['dry_run'] = args.dry_run
+ opts['verbose'] = args.verbose
+ opts['db'] = None
++ opts['sphx'] = None
+ opts['messages'] = 0
+ opts['files'] = 0
+ opts['size'] = 0
+@@ -217,6 +231,8 @@ def main():
+ opts['db'] = dbapi.connect(opts['dbhost'], opts['username'],
+ opts['password'], opts['database'])
+
++ opts['sphx'] = dbapi.connect(host=opts['sphxhost'], port=opts['sphxport'])
++
+ if is_purge_enabled(opts) is False:
+ syslog.syslog("Purging emails is disabled")
+ sys.exit(1)
+@@ -229,13 +245,15 @@ def main():
+ if rows == ():
+ break
+
+- piler_id = [x[0] for x in rows]
+- size = [x[1] for x in rows]
++ id = [x[0] for x in rows]
++ piler_id = [x[1] for x in rows]
++ size = [x[2] for x in rows]
+
+ opts['purged_size'] = opts['purged_size'] + sum(size)
+
+ purge_m_files(piler_id, opts)
+ purge_attachments_by_piler_id(piler_id, opts)
++ purge_index_data(id, opts)
+
+ # It's possible that there's attachment duplication, thus
+ # refcount > 0, even though after deleting the duplicates
+--
+2.42.0
+
diff --git a/testing/piler/APKBUILD b/testing/piler/APKBUILD
new file mode 100644
index 00000000000..62b95da727d
--- /dev/null
+++ b/testing/piler/APKBUILD
@@ -0,0 +1,114 @@
+# Contributor: Noel Kuntze <noel.kuntze@thermi.consulting>
+# Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting>
+pkgname=piler
+pkgver=1.4.4
+pkgrel=0
+pkgdesc="Open source email archiving solution with all the necessary features for your enterprise"
+url="https://www.mailpiler.org/"
+arch="all !ppc64le !s390x !x86 !armhf !armv7" # exclusions because manticore is not built for these architectures
+license="GPL-3.0-only"
+depends="
+ bash
+ catdoc
+ coreutils
+ findutils
+ libzip
+ manticore
+ memcached
+ poppler-utils
+ python3
+ py3-mysqlclient
+ sysstat
+ tnef
+ tre
+ unrtf
+ xlhtml
+ "
+#optional = poppler: for reading attachments
+# catdoc: for reading attachments
+# tnef: for reading attachments
+# bash is required to execute the cron maintenance scripts
+makedepends="$depends mariadb-dev php82-dev openssl-dev tre-dev libzip-dev"
+install="$pkgname.pre-install"
+options="!check"
+subpackages="$pkgname-openrc"
+pkgusers="piler"
+pkggroups="piler"
+source="https://bitbucket.org/jsuto/piler/downloads/piler-$pkgver.tar.gz
+ 0001-utf8_encode_char.patch
+ 0002-manticore-conf.patch
+ 0003-fix_pilerpurge_for_rt_index.patch
+
+ piler.initd
+ piler-smtp.initd
+ searchd.initd
+ searchd.confd
+"
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --sbindir=/usr/bin \
+ --localstatedir=/var \
+ --libexecdir=/usr/lib \
+ --with-database=mysql \
+ --with-piler-user=root \
+ --enable-memcached
+
+ #Attention! The makefile is not formulated correctly for multithreading! We need to use one thread or it breaks.
+ make -j1
+}
+
+package() {
+
+ make installdirs DESTDIR="$pkgdir"
+ make install DESTDIR="$pkgdir"
+
+ # service files
+ rm -rf "$pkgdir"/etc/init.d
+ install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -Dm755 "$srcdir"/$pkgname-smtp.initd "$pkgdir"/etc/init.d/$pkgname-smtp
+ install -Dm755 "$srcdir"/searchd.initd "$pkgdir"/etc/init.d/searchd
+ install -Dm644 "$srcdir"/searchd.confd "$pkgdir"/etc/conf.d/searchd
+
+ # crontab
+ install -Dm600 "$pkgdir"/usr/share/piler/piler.cron "$pkgdir"/etc/crontabs/piler
+
+ # configuration
+ install -Dm655 "$builddir"/contrib/webserver/piler-nginx.conf "$pkgdir"/etc/piler/piler-nginx.conf
+ install -Dm644 "$builddir"/etc/example.conf "$pkgdir"/etc/piler/piler.conf
+ install -Dm644 "$builddir"/etc/smtp.acl.example "$pkgdir"/etc/piler/smtp.acl.example
+ install -Dm644 "$builddir"/util/db-upgrade.sql "$pkgdir"/usr/share/piler/db-upgrade.sql
+ mv "$pkgdir"/etc/piler/manticore.conf.dist "$pkgdir"/etc/piler/manticore.conf
+ mv "$pkgdir"/etc/piler/config-site.dist.php "$pkgdir"/etc/piler/config-site.php
+ rm -f "$pkgdir"/etc/piler/sphinx.conf.dist
+ touch "$pkgdir"/etc/piler/MANTICORE
+
+ # license
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+
+ # Fix directory permissions
+ chmod -R a-s "$pkgdir"/usr/bin
+ chmod 644 "$pkgdir"/etc/piler/*
+ chmod 770 "$pkgdir"/var/piler/www/tmp "$pkgdir"/var/piler/www/images
+ chown piler:www-data "$pkgdir"/var/piler/www/tmp
+
+ install -d "$pkgdir"/var/log/$pkgname
+
+ # remove unnecessary files
+ rm -f "$pkgdir"/usr/lib/piler/*.service "$pkgdir"/usr/lib/piler/postinstall.sh
+}
+
+sha512sums="
+bd53fa14d01fe50c7fa6ccded4404d4ceb6b19ff4484cc2c4f8fde05cc9a66937c701a4378535afc939707d4c27955ec3f31337674506488b10672fc41ba7b4b piler-1.4.4.tar.gz
+017f3c6241a0368efb6d1b1b734c38b52af67753f5245dad42e265f44961c90bd218d947824a02e7ff02aa11edd642a2947aeff64033f4757670948f88478f4a 0001-utf8_encode_char.patch
+6bbf4c70dd51413b6568f2866a28524eb2986fee35fc4921166baa702fbf466ded7c3357ef7987403c3ad694bbd62aad9abfc90ac8313613e31b7b65784c9b08 0002-manticore-conf.patch
+aefef3ff8101c62524f3cd866e3243d4e0cfb2acfd98627db29d9e2d8c12647962bf1b7b62dbd8d0f8b8b20f7719da134dde5d903b4adcf589f5494576ee3e58 0003-fix_pilerpurge_for_rt_index.patch
+f3895913350ffb252455c50bb276cc9fff0603804507d2a3f6ab6167a1b8b357ca8039ccb8725849ffa99fe04673d510dfcdc09f099631a8f0dd148494def615 piler.initd
+3aa8e661c1c806311abecdc76dcbd12a167e64de11785d2a3c63416cd1e5a445eb021ff4882de5fe1a145fc78483b3691262a07fc0168bbfc03b88812cc1ad17 piler-smtp.initd
+c4ad4742c3bd899d8f8004f16252b4862e19683cba6d3d4a7c86d9ed90942c7b3878fc713915aa299b28852f798fedee5ae73e28844d653383d6c7a07698fde4 searchd.initd
+d6a57f4f972786898d39e94666daa36ba6265dbb577d97e4a9586d4e7b2f3f7b4e69537b316529123186df30f530dc54c03af10c88c8e205192d2b8568571bb3 searchd.confd
+"
diff --git a/testing/piler/piler-smtp.initd b/testing/piler/piler-smtp.initd
new file mode 100644
index 00000000000..8070d2d35f7
--- /dev/null
+++ b/testing/piler/piler-smtp.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+
+description="Piler SMTP server"
+
+command="/usr/bin/$SVCNAME"
+command_background=yes
+
+depend() {
+ need net
+ after firewall
+}
+
diff --git a/testing/piler/piler.initd b/testing/piler/piler.initd
new file mode 100644
index 00000000000..3e69b9272b3
--- /dev/null
+++ b/testing/piler/piler.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+
+description="Piler daemon"
+
+command="/usr/bin/$SVCNAME"
+command_background=yes
+
+depend() {
+ need net
+ after firewall mariadb
+}
+
+start_pre() {
+ checkpath -d -m 750 -o piler:piler /run/piler
+}
+
diff --git a/testing/piler/piler.pre-install b/testing/piler/piler.pre-install
new file mode 100644
index 00000000000..e798611b7fd
--- /dev/null
+++ b/testing/piler/piler.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S piler 2>/dev/null
+adduser -S -D -h /var/piler -s /bin/bash -G piler -g piler piler 2>/dev/null
+
+exit 0
diff --git a/testing/piler/searchd.confd b/testing/piler/searchd.confd
new file mode 100644
index 00000000000..e3c05669a0e
--- /dev/null
+++ b/testing/piler/searchd.confd
@@ -0,0 +1,8 @@
+# Configuration for /etc/init.d/searchd
+
+# Path of the configuration file
+#cfgfile="/etc/piler/manticore.conf"
+
+# Additional options to pass to the searchd command
+#command_args=""
+
diff --git a/testing/piler/searchd.initd b/testing/piler/searchd.initd
new file mode 100644
index 00000000000..dd7c0e013f0
--- /dev/null
+++ b/testing/piler/searchd.initd
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:="/etc/piler/manticore.conf"}
+
+Description="Searchd for piler daemon"
+command="/usr/bin/searchd"
+command_args="--config $cfgfile $command_args"
+command_user="piler:piler"
+
+piddir=${piddir:-"/run/piler"}
+pidfile="${piddir}/${SVCNAME}.pid"
+
+depend() {
+ need net
+ after firewall mariadb
+}
+
+start_pre() {
+ checkpath --directory --owner "piler:piler" "$piddir"
+}
+
diff --git a/testing/xlhtml/APKBUILD b/testing/xlhtml/APKBUILD
index a7986f45b6a..5c6db8b7f7b 100644
--- a/testing/xlhtml/APKBUILD
+++ b/testing/xlhtml/APKBUILD
@@ -10,6 +10,7 @@ url="https://chicago.sourceforge.net/xlhtml/"
license='GPL-2.0-or-later '
source="https://bitbucket.org/jsuto/piler/downloads/xlhtml-$pkgver-sj-mod.tar.gz"
options="!check" # no test suite
+subpackages="$pkgname-doc"
builddir="$srcdir/$pkgname-$pkgver-sj-mod"
@@ -20,7 +21,7 @@ prepare() {
}
build() {
- ./configure --prefix=/usr --mandir="$pkgdir/usr/share/man"
+ ./configure.real --prefix=/usr --mandir="$pkgdir/usr/share/man"
make
}