r15: - usebayes as default
[spamassassin-cn.git] / debian / postinst
index ed61747..85f6874 100755 (executable)
@@ -191,6 +191,12 @@ if [ -f $examdir/local.cf ]; then
             $confdir/local.cf.$$ || true
     done
 
+    # remove obsolete options from old SA
+    egrep -v '^(bayes_use_chi2_combining|ok_languages|pyzor)' \
+        $confdir/local.cf.$$ > $confdir/local.cf.$$.$$ && \
+            mv -f $confdir/local.cf.$$.$$ $confdir/local.cf.$$
+    rm -f $confdir/local.cf.$$.$$
+
     # different than template
     if ! cmp -s $confdir/local.cf.$$ $confdir/local.cf; then
         # backup if not zero size
@@ -209,10 +215,11 @@ if [ -f $examdir/local.cf ]; then
 fi
 
 # enable requested plugins in SA
-list=$(find /etc/spamassassin -type -f -name 'v*.pre')
+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
@@ -223,6 +230,7 @@ for i in $list; do
     fi
 
     # enable DKIM
+    cp -f $i $i.$$
     plugin="loadplugin Mail::SpamAssassin::Plugin::DKIM"
     cp_check_and_sed "^.*#.*$plugin.*$" \
         "s/^.*#.*$plugin.*$/$plugin/g" $i.$$ || true
@@ -230,6 +238,16 @@ for i in $list; do
         mv -f $i.$$ $i
     fi
     rm -f $i.$$
+
+    # disable Pyzor
+    cp -f $i $i.$$
+    plugin="loadplugin Mail::SpamAssassin::Plugin::Pyzor"
+    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