Le mercredi 19 décembre 2012 04:35:55, Thomas Preud'homme a écrit :
> See debdiff attached.

As Jakub Wilk pointed me out, dpkg-query got support for db:Status-Abbrev 
later than in the version in squeeze. Fortunetely, this virtual field got added 
before multiarch in dpkg, so I can do the check only if multiarch is present 
and make everything work. See the new debdiff.

Best regards,

Thomas Preud'homme
diff --git a/debian/changelog b/debian/changelog
index b157048..1f05741 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dspam (3.10.1+dfsg-6) unstable; urgency=medium
+
+  * Only lock dspam user account when the last libdspam7 package is purged
+    (Thanks Jakub Wilk for the review, Closes: #695275).
+
+ -- Thomas Preud'homme <robo...@celest.fr>  Wed, 19 Dec 2012 02:17:46 +0100
+
 dspam (3.10.1+dfsg-5) testing-proposed-updates; urgency=low
 
   [ Thomas Preud'homme ]
diff --git a/debian/libdspam7.postrm b/debian/libdspam7.postrm
index 3841a02..4608ac8 100644
--- a/debian/libdspam7.postrm
+++ b/debian/libdspam7.postrm
@@ -1,9 +1,16 @@
 #!/bin/sh
 set -e
 
+# Locks dspam system account on purge of last package
 if [ "$1" = "purge" ] ; then
-    # locks dspam system account on purge
-    usermod -L -e 1 dspam > /dev/null || true
+    # Multi-arch was added in dpkg in a later version than the db:Status-Abbrev
+    # virtual field was added to dpkg-query. Hence, either this bug cannot be
+    # encountered, or db:Status-Abbrev virtual field is available in dpkg-query.
+    if ! dpkg --assert-multi-arch ||
+       ! dpkg-query '-f=${db:Status-Abbrev}\n' -W libdspam7 | grep -vE '(.n|pc)' >/dev/null
+    then
+        usermod -L -e 1 dspam > /dev/null || true
+    fi
 fi
 
 #DEBHELPER#

Reply via email to