Subject: [alpine-aports] [PATCH] testing/rspamd: new aport

From: Valery Kartel <[email-masked]>
Date: Wed, 20 Jan 2016 20:43:52 +0200

Rapid spam filtering system
https://rspamd.com
---
 testing/rspamd/APKBUILD                 | 91 +++++++++++++++++++++++++++++++++
 testing/rspamd/rspamd.conf              | 14 +++++
 testing/rspamd/rspamd.initd             | 29 +++++++++++
 testing/rspamd/rspamd.logrotated        | 11 ++++
 testing/rspamd/rspamd.pre-install       |  6 +++
 testing/rspamd/rspamd.worker_controller |  9 ++++
 testing/rspamd/rspamd.worker_normal     |  6 +++
 7 files changed, 166 insertions(+)
 create mode 100644 testing/rspamd/APKBUILD
 create mode 100644 testing/rspamd/rspamd.conf
 create mode 100644 testing/rspamd/rspamd.initd
 create mode 100644 testing/rspamd/rspamd.logrotated
 create mode 100644 testing/rspamd/rspamd.pre-install
 create mode 100644 testing/rspamd/rspamd.worker_controller
 create mode 100644 testing/rspamd/rspamd.worker_normal

diff --git a/testing/rspamd/APKBUILD b/testing/rspamd/APKBUILD
new file mode 100644
index 0000000..0a92872
--- /dev/null
+++ b/testing/rspamd/APKBUILD
@@ -0,0 +1,91 @@
+# Maintainer: Valery Kartel <[email-masked]>
+# Contributor: Valery Kartel <[email-masked]>
+pkgname=rspamd
+pkgver=1.1.0
+pkgrel=0
+pkgdesc="Rapid spam filtering system."
+url="https://rspamd.com"
+arch="all"
+license="BSD-2-clause"
+pkgusers="rspamd"
+pkggroups="rspamd"
+depends=""
+depends_dev=""
+makedepends="$depends_dev cmake openssl-dev libevent-dev glib-dev gmime-dev
+	luajit-dev sqlite-dev hiredis-dev file-dev pcre-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-web"
+source="https://rspamd.com/downloads/$pkgname-$pkgver.tar.xz
+	$pkgname.logrotated
+	$pkgname.initd
+	$pkgname.conf
+	$pkgname.worker_normal
+	$pkgname.worker_controller
+"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+	cd "$_builddir"
+	cmake CMakeLists.txt \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DEXAMPLESDIR=/usr/share/doc/rspamd/examples \
+		-DCONFDIR=/etc/rspamd \
+		-DDBDIR=/var/lib/$pkgname \
+		-DRUNDIR=/run/$pkgname \
+		-DLOGDIR=/var/log/$pkgname \
+		-DENABLE_HIREDIS=ON \
+		-DRSPAMD_GROUP=$pkggroups \
+		-DRSPAMD_USER=$pkgusers \
+		-DENABLE_HIREDIS=ON \
+	|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" INSTALLDIRS=vendor install || return 1
+	for file in rspamd rspamc rspamadm; do
+		mv "$pkgdir"/usr/bin/$file-$pkgver "$pkgdir"/usr/bin/$file
+	done
+	find "$pkgdir"/usr/bin -type f -exec mv {} $(basename {} -$pkgver) \;
+	mkdir "$pkgdir"/usr/sbin "$pkgdir"/usr/share/doc/$pkgname/www
+	mv "$pkgdir"/usr/bin/rspamd "$pkgdir"/usr/sbin/
+	mv "$pkgdir"/usr/share/$pkgname/www/README.md \
+		"$pkgdir"/usr/share/$pkgname/www/plugins.txt \
+		"$pkgdir"/usr/share/doc/$pkgname/www
+	rm -fr "$pkgdir"/etc/$pkgname/rspamd.* "$pkgdir"/etc/$pkgname/worker-*
+	install -m644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
+	install -Dm644 "$srcdir"/$pkgname.worker_normal "$pkgdir"/etc/$pkgname/worker.d/normal.conf
+	install -Dm644 "$srcdir"/$pkgname.logrotated "$pkgdir"/etc/logrotate.d/$pkgname
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -dm750 -o $pkgusers -g $pkggroups "$pkgdir"/var/lib/$pkgname
+	install -dm750 -g $pkggroups "$pkgdir"/var/log/$pkgname
+}
+
+web() {
+	arch="noarch"
+	pkgdesc="$pkgdesc (web control interface)"
+	mkdir -p "$subpkgdir"/usr/share/$pkgname
+	mv "$pkgdir"/usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
+	install -Dm644 "$srcdir"/$pkgname.worker_controller "$subpkgdir"/etc/$pkgname/worker.d/controller.conf
+}
+
+md5sums="c14cc28bc346a3f12623e472ba508f43  rspamd-1.1.0.tar.xz
+3fd4d0e28cb01224a786c0498266e9a6  rspamd.logrotated
+cbf6a8191c7ce4b7c4fe481cad58f1a4  rspamd.initd
+a5f0967b3d9aa319909af7e1bfe998e1  rspamd.conf
+74e334227e9244c419abd605787c090e  rspamd.worker_normal
+03bd84228945261e2242564f9bf5f1ca  rspamd.worker_controller"
+sha256sums="69db05150b4ba8304d24dd0f96c79b5d3792478373f0d6be6c92b51b1cf60ead  rspamd-1.1.0.tar.xz
+cb02c8c041a0ace2e3c9e4fbf514038871b4444575c9022a75e661130db875fd  rspamd.logrotated
+0e4d1ce24ce9ec0451f4498dcadc391721affc63be3c693564df29f9b23b0c7a  rspamd.initd
+5a223efb12e962e0f3bfe9f6d08336c6074b0b2930b8da6a22fe6582142ee40c  rspamd.conf
+7805103a2e11cf816e99dba7d67fdc584ece33d9ea3ef95f95f4fce91a34eb90  rspamd.worker_normal
+f50663096866b35095f7a6754e3cfb0bab518645d61646703715cf43da5adf77  rspamd.worker_controller"
+sha512sums="41a8fb49a10082b1dc97397ebb8ac81dd3f4912e9140dcb7c57c9e15f1e49cf472aa94570a2f802b82e3db8ab8a87dd6a63f7db7249da4d99473700535045256  rspamd-1.1.0.tar.xz
+3b95882b1804d8dc6524a4c2cdf3f656b2f9bf5db6228b92d1acd539629070aead654c1f58937e1473e4f07340dc3de7b212f87b36143c5cb3fcb3b472a85f5a  rspamd.logrotated
+f41f72ace36af2d55e4b900580953b72933cc9cd53213e0ff40439eeab45713ebe07cafa14e5ac7951b96e0984d875d507fd4adb8e1501f0954324118c0abf68  rspamd.initd
+90885bd8f9fcd47590eedf8f1f058df7c492005fc09058e99ee490e1730f4961909850ecf9e98723bfbd3cbe8df705f86a0de931dedb25bc66b246674f537a72  rspamd.conf
+ddf1af03878ed2f4b1e735ecd9f931f1941adf7b2085aa7a40f3ef303fa5c59791d0d7462064c2ac652af2722b83acd4379f549d341cb62767e74edefb69ba9a  rspamd.worker_normal
+932486ee517ca55534e93eb634badd9082a3952e25a66f98468c7b9c29ce4a26a5a96f465ee347dfd5443d330b1dd11b72680bc6ac04c2ebe45412f4432e8f62  rspamd.worker_controller"
diff --git a/testing/rspamd/rspamd.conf b/testing/rspamd/rspamd.conf
new file mode 100644
index 0000000..93c025c
--- /dev/null
+++ b/testing/rspamd/rspamd.conf
@@ -0,0 +1,14 @@
+.include "$CONFDIR/common.conf"
+
+options {
+    pidfile = "$RUNDIR/rspamd.pid";
+    .include "$CONFDIR/options.inc"
+}
+
+logging {
+    type = "file";
+    filename = "$LOGDIR/rspamd.log";
+    .include "$CONFDIR/logging.inc"
+}
+
+.include(glob=true) "$CONFDIR/worker.d/*.conf"
diff --git a/testing/rspamd/rspamd.initd b/testing/rspamd/rspamd.initd
new file mode 100644
index 0000000..5189e49
--- /dev/null
+++ b/testing/rspamd/rspamd.initd
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+
+description="Rapid spam filtering system"
+command="/usr/sbin/rspamd"
+command_args="-u rspamd -g rspamd"
+cfgfile=${cfgfile:-/etc/rspamd/rspamd.conf}
+pidfile="/run/rspamd/rspamd.pid"
+required_files="$cfgfile"
+extra_started_commands="reload"
+description_reload="Reload configuration"
+
+depend() {
+	need localmount net
+	before exim postfix
+}
+
+start_pre() {
+	ebegin
+	[ "$cfgfile" = "/etc/rspamd/rspamd.conf" ] || command_args="$command_args -c $cfgfile"
+	checkpath --directory --mode 750 --owner rspamd:rspamd "${pidfile%/*}"
+	$command $command_args -t &>/dev/null
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --signal HUP --pidfile ${pidfile}
+	eend $?
+}
diff --git a/testing/rspamd/rspamd.logrotated b/testing/rspamd/rspamd.logrotated
new file mode 100644
index 0000000..8a30971
--- /dev/null
+++ b/testing/rspamd/rspamd.logrotated
@@ -0,0 +1,11 @@
+/var/log/rspamd/*log {
+    daily
+    rotate 10
+    missingok
+    notifempty
+    compress
+    sharedscripts
+    postrotate
+        /etc/init.d/rspamd --ifstarted reload
+    endscript
+}
diff --git a/testing/rspamd/rspamd.pre-install b/testing/rspamd/rspamd.pre-install
new file mode 100644
index 0000000..db50214
--- /dev/null
+++ b/testing/rspamd/rspamd.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S rspamd 2>/dev/null
+adduser -h /var/lib/rspamd -g "rspamd spam filtering system" -s /bin/false -SDHG rspamd rspamd 2>/dev/null
+
+exit 0
diff --git a/testing/rspamd/rspamd.worker_controller b/testing/rspamd/rspamd.worker_controller
new file mode 100644
index 0000000..0ce0a75
--- /dev/null
+++ b/testing/rspamd/rspamd.worker_controller
@@ -0,0 +1,9 @@
+worker {
+    bind_socket = "localhost:11334";
+    type = "controller";
+    count = 1;
+    password = "q1";
+    secure_ip = "127.0.0.1";
+    secure_ip = "::1";
+    static_dir = "${WWWDIR}";
+}
diff --git a/testing/rspamd/rspamd.worker_normal b/testing/rspamd/rspamd.worker_normal
new file mode 100644
index 0000000..72c86c0
--- /dev/null
+++ b/testing/rspamd/rspamd.worker_normal
@@ -0,0 +1,6 @@
+worker {
+    bind_socket = "*:11333";
+    type = "normal";
+    mime = true;
+    task_timeout = 8s;
+}
-- 
2.7.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---