debian/preinst: fix maintainer-script-uses-dpkg-status-directly 1.0.11
authorMichael Prokop <mika@grml.org>
Wed, 4 Jul 2007 10:32:36 +0000 (12:32 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 4 Jul 2007 10:32:36 +0000 (12:32 +0200)
debian/changelog
debian/preinst

index 5a5a95a..fd48ce0 100644 (file)
@@ -2,6 +2,10 @@ grml-etc (1.0.11) unstable; urgency=low
 
   * /etc/init.d/grml-reboot: cosmetic fix (drop an empty line of
     output which seems unnecessary nowadays)
+  * debian/preinst: change /var/lib/dpkg/status code to the usual
+    dpkg-query solution (as http://wiki.debian.org/DpkgConffileHandling
+    suggests) to make lintian happy
+    (hello maintainer-script-uses-dpkg-status-directly).
 
  -- Michael Prokop <mika@grml.org>  Sun, 01 Jul 2007 20:21:45 +0200
 
index 615ed55..da3ff00 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Don Nov 02 20:58:57 CET 2006 [mika]
+# Latest change: Mit Jul 04 12:31:26 CEST 2007 [mika]
 ################################################################################
 
 set -e
@@ -28,9 +28,10 @@ rm_conffile() {
 
     if [ -e "$CONFFILE" ]; then
         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
-        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
+       old_md5sum="`dpkg-query -W -f='${Conffiles}' grml-etc | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
         if [ "$md5sum" != "$old_md5sum" ]; then
-            echo "Conffile $CONFFILE has been modified, temporary moving to $CONFFILE.dpkg-bak ..."
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+           echo "Saving as $CONFFILE.dpkg-bak ..."
             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
         fi
     fi