Subject: [alpine-aports] [PATCH v6] testing/rspamd: upgrade to 1.4.4

From: Valery Kartel <[email-masked]>
Date: Wed, 1 Mar 2017 11:00:06 +0200

---
v1 -> v2: add checkconfig command to init script

v2 -> v3: fix checksums

v3 -> v4: remade init-script with checkconfig sub

v4 -> v5: remade init.d and conf.d to use unique RSPAMD_* vars
          remade checkconfig to be a user-called command

v5 -> v6: simplify init script
---
 testing/rspamd/APKBUILD     | 22 +++++-----------------
 testing/rspamd/rspamd.confd | 15 ++++++++-------
 testing/rspamd/rspamd.initd | 31 ++++++++++++++++++++-----------
 3 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/testing/rspamd/APKBUILD b/testing/rspamd/APKBUILD
index 85fc20a1b8..78437d599f 100644
--- a/testing/rspamd/APKBUILD
+++ b/testing/rspamd/APKBUILD
@@ -2,8 +2,8 @@
 # Contributor: Valery Kartel <[email-masked]>
 # Contributor: Nathan Angelacos <[email-masked]>
 pkgname=rspamd
-pkgver=1.4.3
-pkgrel=1
+pkgver=1.4.4
+pkgrel=0
 pkgdesc="Fast, free and open-source spam filtering system"
 url="https://rspamd.com"
 arch="x86_64 x86 armhf"
@@ -106,21 +106,9 @@ utils() {
 	mv "$pkgdir"/usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin
 }
 
-md5sums="a64e00b906b7f3590e855be50106f99f  rspamd-1.4.3.tar.xz
-c152c6a90f6ae9e5a7a1d137dfbc0305  rspamd.logrotated
-0656acc12dcce7cba232857a848d0390  rspamd.initd
-ab12f33ad8e12a7437fb5ea4a9c92eef  rspamd.confd
-ff0bf4f1b1447ca401865369f91418f1  config.patch
-83f76787389649af63ea921f81cf35b3  cmakelists.patch"
-sha256sums="144cddc25ce8d8519b289d2c00d34b37c931f3c7293e2b0d16c408680021a1bf  rspamd-1.4.3.tar.xz
-6c5e79e9052d957f3d0d634b2ae7a56bbc0901a5d6946dc991c92f19a72fce97  rspamd.logrotated
-5bcf68a72e0582859799cd335a14d48914e5291f4087327b3b42562ef64e2958  rspamd.initd
-fceba39a20755d48ef3838f7daa92ed9686a118c0a26f06bfe72cc7c15b2e384  rspamd.confd
-7e0adb4a2e7e8f806fc5fdae0c37e6948ed56e9d46d4eed0c681806decb90e49  config.patch
-d4bc7851bb32b49be98e3964aa9195033b586da27f7f3afa5ce12dfbeadd96b0  cmakelists.patch"
-sha512sums="bae86953d881be446f049384cc8bf8451b04619b461a7e2d571407d5af5f2547af8bc9db578e84190e8c55d01f9e32ea1d29e998daa2bbb2fac431ed50df27ca  rspamd-1.4.3.tar.xz
+sha512sums="df2260de6585699a5b6692aa210647270b7132372ae6a2437f8532265018fe4db8270a8989ce0c0664cad17cbc281ae92f935c4f0974dc2f8da309e54c234b14  rspamd-1.4.4.tar.xz
 2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
-e240983c2fd91d8061b17e35e83a75c56ac2c3625dbe07b83a2e89e3dbf69b57c675d01772b93968aa6b22d150d54d366f2fb4a0c6551b3cfdedc77d82e28652  rspamd.initd
-1320a752cbefe021079b3ed23e312231c39fc600baba7d8440c3e8bdd33ed673c8831b44a0c76788a8d905469e81088adf26cf245c09b4c2c4fdce7ff4219ee7  rspamd.confd
+df37726d03e676b16d707854d95bafc9162da65c27bb150edbfc0cb00f1842188a1f2a8f1b82be5ae2a253b4f4db4d93dfe804a89feb988b5af858eb3f3458be  rspamd.initd
+e417dd825d1b4d03d115db037b2fdf2f48a35420ee7a9010d97167b6c31e88d6c0a15dd33b21d7d76856db0fdc5097c922fcdf1d8164d1e92ae377f7c5303947  rspamd.confd
 2089429e6f44f8204f31c87c565cdd7abcd51b3146397ba1b2fb23b1be6faf46fd8ec36718f194a3fc38ac1d38d7be9010a84ac4b49d7e1597706699538c607a  config.patch
 99593c10ffb04c71a4c83c7522b41f12465a9862283685bbc2fff464fd84fcf8b4bc4a892419d31332c01f805c69dd7730f537c60248b92fee35acdc6633a644  cmakelists.patch"
diff --git a/testing/rspamd/rspamd.confd b/testing/rspamd/rspamd.confd
index 9b2cc4b34f..e804b2b642 100644
--- a/testing/rspamd/rspamd.confd
+++ b/testing/rspamd/rspamd.confd
@@ -1,15 +1,16 @@
 # User and group to run rspamd workers
-#user=rspamd
-#group=rspamd
+#RSPAMD_USER=rspamd
+#RSPAMD_GROUP=rspamd
 
-# Main config file
-#cfgfile=/etc/rspamd/rspamd.conf
+# Main config dir or file
+#RSPAMD_CONFDIR=/etc/rspamd
+#RSPAMD_CONFIG=/etc/rspamd/rspamd.conf
 
 # PID file. Settings from config files are ignored
-#pidfile=/run/rspamd/rspamd.pid
+#RSPAMD_PIDFILE=/run/$RC_SVCNAME/rspamd.pid
 
 # Where to log startup configuration checking
 # - /dev/null - silent (default)
-# - /dev/tty - show output on curent terminal
+# - /dev/stdout - show output on curent terminal
 # - /path/filename - append to specified logfile
-#startuplog=/var/log/rspamd/startup.log
+#RSPAMD_STARTUPLOG=/var/log/rspamd/startup.log
diff --git a/testing/rspamd/rspamd.initd b/testing/rspamd/rspamd.initd
index 93148ccb4b..79e9d0d910 100644
--- a/testing/rspamd/rspamd.initd
+++ b/testing/rspamd/rspamd.initd
@@ -1,14 +1,19 @@
 #!/sbin/openrc-run
 
 description="Rapid spam filtering system"
-user=${user:-rspamd}
-group=${group:-rspamd}
-cfgfile=${cfgfile:-/etc/rspamd/rspamd.conf}
-pidfile=${pidfile:-/run/rspamd/rspamd.pid}
+
+: ${user:=${RSPAMD_USER:-rspamd}}
+: ${group:=${RSPAMD_GROUP:-rspamd}}
+: ${cfgdir:=${RSPAMD_CONFDIR:-/etc/rspamd}}
+: ${cfgfile:=${RSPAMD_CONFIG:-$cfgdir/rspamd.conf}}
+: ${pidfile:=${RSPAMD_PIDFILE:-/run/$RC_SVCNAME/rspamd.pid}}
+
 command=/usr/sbin/rspamd
 command_args="-u $user -g $group -c $cfgfile -p $pidfile"
 required_files="$cfgfile"
+extra_commands="checkconfig"
 extra_started_commands="reload reopen"
+description_checkconfig="Verify configuration"
 description_reload="Reload configuration"
 description_reopen="Reopen log files"
 
@@ -17,21 +22,25 @@ depend() {
 	before mta
 }
 
-start_pre() {
-	ebegin
-	checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*}
-	$command $command_args -t >/dev/null 2>>${startuplog:-/dev/null}
+checkconfig() {
+	ebegin "Checking $RC_SVCNAME config"
+	$command $command_args -t
 	eend $?
 }
 
+start_pre() {
+	checkpath -d -m 750 -o $user:$group ${pidfile%/*}
+	checkconfig >/dev/null 2>>${startuplog:=${RSPAMD_STARTUPLOG:-/dev/null}}
+}
+
 reload() {
-	ebegin "Reloading ${SVCNAME}"
-	start-stop-daemon --signal HUP --pidfile $pidfile
+	ebegin "Reloading $RC_SVCNAME config"
+	checkconfig >/dev/null 2>&1 && start-stop-daemon --signal HUP --pidfile $pidfile
 	eend $?
 }
 
 reopen() {
-	ebegin "Reopening ${SVCNAME} log files"
+	ebegin "Reopening $RC_SVCNAME log files"
 	start-stop-daemon --signal USR1 --pidfile $pidfile
 	eend $?
 }
-- 
2.11.1

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

---

From: Natanael Copa <[email-masked]>
Date: Wed, 1 Mar 2017 14:56:06 +0100

On Wed,  1 Mar 2017 11:00:06 +0200

>  3 files changed, 33 insertions(+), 35 deletions(-)

Beautiful! Thank you!

-nc

---