r11: - enable DCC plugin
[spamassassin-cn.git] / debian / postinst
index 0fc4320..ed61747 100755 (executable)
@@ -208,6 +208,30 @@ 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
+        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
+    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