r28:
authorIvan Rako <Ivan.Rako@CARNet.hr>
Sun, 24 Feb 2008 18:52:29 +0000 (18:52 +0000)
committerIvan Rako <Ivan.Rako@CARNet.hr>
Sun, 24 Feb 2008 18:52:29 +0000 (18:52 +0000)
debian/postinst

index b1516e8..8fd8605 100755 (executable)
@@ -90,19 +90,17 @@ fi
 check_and_add_alias virusalert root
 check_and_add_alias spamalert root
 
-if [ ! -f $AHOME/.spamassassin/user_prefs ] ; then
-  [ -d $AHOME/.spamassassin ] || mkdir -p $AHOME/.spamassassin
-  cat > $AHOME/.spamassassin/user_prefs <<-EEND
+if [ -f $AHOME/.spamassassin/user_prefs ] ; then
+  user_prefs_temp=out=$(mktemp /tmp/user_prefs.XXXXXX)
+  cat > $user_prefs_temp <<-EEND
        bayes_path              $AHOME/.spamassassin/bayes
        bayes_auto_expire       0
        auto_whitelist_path     $AHOME/.spamassassin/auto-whitelist
        EEND
-  chown_ahome=1
-fi
-
-if [ ! -f $AHOME/.spamassassin/auto-whitelist ] ; then
-  touch $AHOME/.spamassassin/auto-whitelist
-  chown_ahome=1
+  if cmp -s $user_prefs_temp $AHOME/.spamassassin/user_prefs; then
+    rm -f $AHOME/.spamassassin/user_prefs
+  fi
+  rm -f $user_prefs_temp
 fi
 
 # No sysvinit order fixes