summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEbben Aries <e@dscp.org>2018-11-26 22:42:17 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-12-01 07:27:47 +0700
commitc47042f4c58235442a15d152ed97fe9b352d1d0d (patch)
tree816707047937a3fce5d5a12f8d45bb818f79ecd5
parent43ab7d5e9cf69fab9a1be83368e6cbb02bc8b342 (diff)
downloadslackbuilds-c47042f4c58235442a15d152ed97fe9b352d1d0d.tar.gz
network/rspamd: Updated for version 1.8.2.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
-rw-r--r--network/rspamd/README7
-rw-r--r--network/rspamd/doinst.sh26
-rw-r--r--network/rspamd/rc.rspamd.new67
-rw-r--r--network/rspamd/rspamd.SlackBuild32
-rw-r--r--network/rspamd/rspamd.info8
5 files changed, 134 insertions, 6 deletions
diff --git a/network/rspamd/README b/network/rspamd/README
index 01bded1e3d..705ffd1689 100644
--- a/network/rspamd/README
+++ b/network/rspamd/README
@@ -10,3 +10,10 @@ an action for the MTA to apply to the message: for example, to pass, to
reject or to add a header. Rspamd is designed to process hundreds of
messages per second simultaneously and has a number of features
available.
+
+Groupname and Username
+
+You must have the "rspamd" group and user to run this script, for example:
+
+ groupadd -g 359 rspamd
+ useradd -u 359 -s /bin/false -d /dev/null -g rspamd rspamd
diff --git a/network/rspamd/doinst.sh b/network/rspamd/doinst.sh
new file mode 100644
index 0000000000..533485ecf5
--- /dev/null
+++ b/network/rspamd/doinst.sh
@@ -0,0 +1,26 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+config etc/rspamd/rspamd.conf.new
+preserve_perms etc/rc.d/rc.rspamd.new
diff --git a/network/rspamd/rc.rspamd.new b/network/rspamd/rc.rspamd.new
new file mode 100644
index 0000000000..8c3e78f908
--- /dev/null
+++ b/network/rspamd/rc.rspamd.new
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# rspamd startup script for Slackware Linux
+
+NAME=rspamd
+DAEMON=/usr/bin/$NAME
+RSPAMADM=/usr/bin/rspamadm
+PIDFILE=/var/run/rspamd/${NAME}.pid
+CONF=/etc/rspamd/rspamd.conf
+DAEMON_ARGS="-c $CONF -u $NAME -g $NAME"
+
+rspamd_start() {
+ if [ ! -r $CONF ]; then
+ echo "$CONF does not appear to exist. Abort."
+ exit 1
+ fi
+
+ if [ -s $PIDFILE ]; then
+ echo "rspamd appears to be already running?"
+ exit 1
+ fi
+
+ echo "Starting rspamd ..."
+ $DAEMON $DAEMON_ARGS
+}
+
+rspamd_stop() {
+ if [ ! -s $PIDFILE ]; then
+ echo "$PIDFILE does not exist or is empty."
+ exit 1
+ fi
+
+ PID=$(cat $PIDFILE)
+ echo -n "Stopping rspamd ..."
+ kill -TERM $(cat $PIDFILE)
+ rm -f $PIDFILE
+ echo " done"
+}
+
+rspamd_restart() {
+ rspamd_configtest || return $?
+ rspamd_stop
+ sleep 3
+ rspamd_start
+}
+
+rspamd_configtest() {
+ $RSPAMADM configtest -c $CONF
+}
+
+case "$1" in
+ start)
+ rspamd_start
+ ;;
+ stop)
+ rspamd_stop
+ ;;
+ restart)
+ rspamd_restart
+ ;;
+ configtest)
+ rspamd_configtest
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|configtest}"
+ exit 1
+esac
diff --git a/network/rspamd/rspamd.SlackBuild b/network/rspamd/rspamd.SlackBuild
index 3e9864993b..72692e89f2 100644
--- a/network/rspamd/rspamd.SlackBuild
+++ b/network/rspamd/rspamd.SlackBuild
@@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=rspamd
-VERSION=${VERSION:-1.8.1}
+VERSION=${VERSION:-1.8.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -35,6 +35,17 @@ if [ -z "$ARCH" ]; then
esac
fi
+UIDGID=359
+if ! getent group $PRGNAM; then
+ echo " You must have the \"$PRGNAM\" group to run this script."
+ echo " # groupadd -g $UIDGID $PRGNAM"
+ exit 1
+elif ! getent passwd $PRGNAM; then
+ echo " You must have the \"$PRGNAM\" user to run this script."
+ echo " # useradd -u $UIDGID -s /bin/false -d /dev/null -g $PRGNAM $PRGNAM"
+ exit 1
+fi
+
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
@@ -77,7 +88,6 @@ cd build
-DCONFDIR=/etc/$PRGNAM \
-DLIBDIR=/usr/lib${LIBDIRSUFFIX}/$PRGNAM \
-DMANDIR=/usr/man \
- -DEXAMPLESDIR=/usr/doc/$PRGNAM-$VERSION/examples \
-DENABLE_STATIC=OFF \
-DENABLE_HYPERSCAN=ON \
-DENABLE_JEMALLOC=ON \
@@ -93,6 +103,23 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+# remove empty directory tree
+rmdir -p --ignore-fail-on-non-empty $PKG/usr/share/examples/rspamd
+
+mkdir -p $PKG/var/log/rspamd
+chown rspamd:rspamd $PKG/var/log/rspamd
+chmod 0755 $PKG/var/log/rspamd
+
+mkdir -p $PKG/var/run/rspamd
+chown rspamd:rspamd $PKG/var/run/rspamd
+chmod 0750 $PKG/var/run/rspamd
+
+mkdir -p $PKG/var/lib/rspamd
+chown rspamd:rspamd $PKG/var/lib/rspamd
+chmod 0750 $PKG/var/lib/rspamd
+
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.rspamd.new > $PKG/etc/rc.d/rc.rspamd.new
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS.md ChangeLog CONTRIBUTIONS.md LICENSE.md README.md \
@@ -101,6 +128,7 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/rspamd/rspamd.info b/network/rspamd/rspamd.info
index c5d451e1c1..d9d447b429 100644
--- a/network/rspamd/rspamd.info
+++ b/network/rspamd/rspamd.info
@@ -1,10 +1,10 @@
PRGNAM="rspamd"
-VERSION="1.8.1"
+VERSION="1.8.2"
HOMEPAGE="https://rspamd.com"
-DOWNLOAD="https://github.com/rspamd/rspamd/archive/1.8.1/rspamd-1.8.1.tar.gz"
-MD5SUM="4dfc339a639295ba3fa3bfe0f9dbf6b0"
+DOWNLOAD="https://github.com/rspamd/rspamd/archive/1.8.2/rspamd-1.8.2.tar.gz"
+MD5SUM="14b50a717c0997381c3d3be77967c500"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES="luajit redis hyperscan"
+REQUIRES="ragel luajit redis hyperscan"
MAINTAINER="Ebben Aries"
EMAIL="e@dscp.org"