#!/bin/sh
-# postinst script for spamassassin-cn
-#
-# see: dh_installdeb(1)
set -e
-# summary of how this script can be called:
-# * <postinst> `configure' <most-recently-configured-version>
-# * <old-postinst> `abort-upgrade' <new version>
-# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-# <new-version>
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-#
-
-case "$1" in
- configure|reconfigure)
- # continue below
- ;;
-
- *)
- exit 0
- ;;
-esac
-
-# import CN-functions
+[ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
+
+# Load CARNet Tools
. /usr/share/carnet-tools/functions.sh
-# load Debconf
+# Load Debconf
. /usr/share/debconf/confmodule
+
db_version 2.0
umask 022
if [ "$run_as_user" = "non-root" ]; then
if ! grep -q '^OPTIONS=".*username=spamd"' \
/etc/default/spamassassin; then
- service stop spamassassin
+ service spamassassin stop
rstart=yes
fi
elif [ "$run_as_user" = "root" ]; then
if grep -q '^OPTIONS=".*username=spamd"' \
/etc/default/spamassassin; then
- service stop spamassassin
+ service spamassassin stop
restart=yes
fi
sa-update --import /etc/spamassassin/sa-keys.pgp \
>>/var/log/sa-update.log 2>&1 || true
+# import http://spamassassin.apache.org/updates/GPG.KEY
+echo "CN: Importing new http://spamassassin.apache.org/updates/GPG.KEY..."
+sa-update --import /usr/share/spamassassin-cn/GPG.KEY
+
# clean old RulesDuJour rules
echo "CN: Cleaning old RulesDuJour and SARE rules..."
rm -rf /etc/spamassassin/*_sare_*.cf /etc/spamassassin/RulesDuJour
# restart the spamasassin
if [ "x$restart" = "xyes" ]; then
pkill -f /usr/sbin/spamd || true
- service restart spamassassin
+ service spamassassin restart
fi
# restart the amavis
if [ "x$restart" = "xyes" -a -x /etc/init.d/amavis ]; then
- service restart amavis
+ service amavis restart
fi
# dh_installdeb will replace this with shell code automatically