Control: tag -1 + pending

On Sun, 18 Nov 2012 22:11:26 +0100, Franck Joncourt wrote:

> >did you have the time to look into this bug and my patch?
> The patch looks good to me even if this is not very elegant indeed.

Thanks for checking!
 
> >If it helps I can upload it.
> I would appreciate. Thanks for your help gregor.

You're welcome; and: uploaded (to DELAYED/1 in case Andreas or
someone else wants to check again).


Cheers,
gregor, attaching the recent debdiff

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Funny van Dannen: Der Wind
diff -Nru psad-2.2/debian/changelog psad-2.2/debian/changelog
--- psad-2.2/debian/changelog	2012-10-28 16:07:12.000000000 +0100
+++ psad-2.2/debian/changelog	2012-11-18 22:27:00.000000000 +0100
@@ -1,3 +1,14 @@
+psad (2.2-3.1) unstable; urgency=low
+
+  * Non-maintainer upload with maintainer's approval.
+  * Fix "modifies conffiles (policy 10.7.3): /etc/psad/psad.conf", second try:
+    - add back changes to d.psad.preinst that revert changes to
+      /etc/psad/psad.conf
+    - but only for upgrades from versions before 2.2-3
+    (Closes: #688891)
+
+ -- gregor herrmann <gre...@debian.org>  Sun, 18 Nov 2012 22:25:13 +0100
+
 psad (2.2-3) unstable; urgency=low
 
   * Fix "modifies conffiles (policy 10.7.3): /etc/psad/psad.conf"
diff -Nru psad-2.2/debian/psad.preinst psad-2.2/debian/psad.preinst
--- psad-2.2/debian/psad.preinst	2012-10-28 16:07:12.000000000 +0100
+++ psad-2.2/debian/psad.preinst	2012-11-04 16:04:04.000000000 +0100
@@ -1,14 +1,54 @@
 #!/bin/sh
 
-# This script is only intended to fix bug #497574.
-# We check for an upgrade from Psad older than 2.1.5 and remove the old
-# Psad process if needed.
 #
-# NB: As some commands can return an exit code other than 0 we do not use
-# *set -e* at the beginning.
+# Update_conf
+#
+# This function searchs a key entry in a file and updates its value with the new
+# one.
+#
+# Syntax:
+#
+#    update_conf new_val key conffile
+#      -> new_val ... : Value to set for the key value
+#      -> key ....... : Name of the key to be updated
+#      -> conffile .. : File to search
+#
+update_conf ()
+{
+        local new_val
+        local key
+        local conffile
+
+        new_val=$1
+        key=$2
+        conffile=$3
+
+        cp $conffile $conffile.old
+
+        old_val=`awk '$1 == "'$key'" { print $2 }' $conffile`
+        awk '$1 == "'$key'" { gsub("'$old_val'","'$new_val';",$0); \
+                           print $0 } \
+                 $1 != "'$key'" { print $0 }' \
+                 $conffile.old > $conffile
+
+        rm $conffile.old
+}
 
 if [ "$1" = "upgrade" ]; then
 
+    # Revert changes added to the configuration file by the postinst script
+    # if we are upgrading from a version which changed it (#688891)
+    if [ -n "$2" ] && dpkg --compare-versions 2.2-3 gt $2 ; then
+        update_conf "_CHANGEME_" "HOSTNAME" "/etc/psad/psad.conf"
+    fi
+
+    # This script is only intended to fix bug #497574.
+    # We check for an upgrade from Psad older than 2.1.5 and remove the old
+    # Psad process if needed.
+    #
+    # NB: As some commands can return an exit code other than 0 we do not use
+    # *set -e* at the beginning.
+
     status=1;
     if [ -x "`which dpkg 2>/dev/null`" ]; then 
         dpkg --compare-versions 2.1.5 gt $2

Attachment: signature.asc
Description: Digital signature

Reply via email to