r13: - changelog
[spamassassin-cn.git] / debian / postinst
index ee11369..36ac9ec 100755 (executable)
@@ -208,6 +208,32 @@ if [ -f $examdir/local.cf ]; then
     rm -f $confdir/local.cf.$$
 fi
 
+# enable requested plugins in SA
+list=$(find /etc/spamassassin -type f -name 'v*.pre')
+for i in $list; do
+    # enable DCC if requested
+    if [ "$use_dcc" = "true" ]; then
+        cp -f $i $i.$$
+        plugin="loadplugin Mail::SpamAssassin::Plugin::DCC"
+        cp_check_and_sed "^.*#.*$plugin.*$" \
+            "s/^.*#.*$plugin.*$/$plugin/g" $i.$$ || true
+        if ! cmp -s $i.$$ $i; then
+            mv -f $i.$$ $i
+        fi
+        rm -f $i.$$
+    fi
+
+    # enable DKIM
+    cp -f $i $i.$$
+    plugin="loadplugin Mail::SpamAssassin::Plugin::DKIM"
+    cp_check_and_sed "^.*#.*$plugin.*$" \
+        "s/^.*#.*$plugin.*$/$plugin/g" $i.$$ || true
+    if ! cmp -s $i.$$ $i; then
+        mv -f $i.$$ $i
+    fi
+    rm -f $i.$$
+done
+
 # check and replace /etc/default/spamasassin if needed
 if [ "$run_service" = "true" -a \
         -f $examdir/etc-default-spamassassin-$run_as_user ]; then
@@ -262,7 +288,8 @@ fi
 if getent passwd amavis >/dev/null 2>&1; then
   if [ -s ~amavis/.spamassassin/auto-whitelist ]; then
     echo "CN: Cleaning the Amavis auto-whitelist"
-    su -c '/usr/bin/check_whitelist --clean' - amavis >/dev/null 2>&1 
+    su -c '/usr/bin/check_whitelist --clean' - amavis >/dev/null 2>&1 \
+      || true
   fi
 fi