aboutsummaryrefslogtreecommitdiff
path: root/network/rspamd/doinst.sh
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 /network/rspamd/doinst.sh
parent43ab7d5e9cf69fab9a1be83368e6cbb02bc8b342 (diff)
network/rspamd: Updated for version 1.8.2.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/rspamd/doinst.sh')
-rw-r--r--network/rspamd/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/network/rspamd/doinst.sh b/network/rspamd/doinst.sh
new file mode 100644
index 0000000000000..533485ecf56c7
--- /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