retitle 399790 deluser fails in purge [+NMU diff]
thanks

On Wed, 22 Nov 2006, Peter Palfrader wrote:

> Package: amanda-common
> Version: 1:2.5.1p1-2
> Severity: serious
> 
> postrm fails when deluser fails:
> 
> | /usr/sbin/deluser: The user `backup' is not a member of group `disk'.
> | dpkg: error processing amanda-common (--purge):
> |  subprocess post-removal script returned error exit status 6
> | Errors were encountered while processing:
> |  amanda-common
> | E: Sub-process /usr/bin/dpkg returned an error code (1)
> | A package failed to install.  Trying to recover:

I have uploaded an NMU to DELAYED-4.

This is the gist of the patch, complete interdiff attached.

--- amanda-2.5.1p1/debian/postrm
+++ amanda-2.5.1p1/debian/postrm
@@ -27,8 +27,17 @@
 
        rm -f ~backup/.amandahosts
 
-       deluser backup disk
-       deluser backup tape
+       if which deluser >/dev/null 2>&1 ; then
+               for group in disk tape; do
+                       # only call deluser when backup is in $group
+                       if getent group "$group" |
+                          awk -F: '{ print $4 }' |
+                          awk -F, '{ for (i=1; i <= NF; i++ ) print $i }' |
+                          grep '^backup$' > /dev/null; then
+                               deluser backup "$group" || true
+                       fi
+               done
+       fi
   ;;
   remove|upgrade|deconfigure)
   ;;

-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/
diff -u amanda-2.5.1p1/config/config.sub amanda-2.5.1p1/config/config.sub
--- amanda-2.5.1p1/config/config.sub
+++ amanda-2.5.1p1/config/config.sub
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
 #   Inc.
 
-timestamp='2006-09-20'
+timestamp='2006-07-02'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -276,7 +276,6 @@
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
-       | score \
        | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | 
sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | 
sparclite \
@@ -285,7 +284,7 @@
        | tahoe | thumb | tic4x | tic80 | tron \
        | v850 | v850e \
        | we32k \
-       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
        | z8k)
                basic_machine=$basic_machine-unknown
                ;;
@@ -368,7 +367,7 @@
        | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
        | xstormy16-* | xtensa-* \
        | ymp-* \
        | z8k-*)
@@ -910,10 +909,6 @@
        sb1el)
                basic_machine=mipsisa64sb1el-unknown
                ;;
-       sde)
-               basic_machine=mipsisa32-sde
-               os=-elf
-               ;;
        sei)
                basic_machine=mips-sei
                os=-seiux
@@ -1371,9 +1366,6 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
-               os=-elf
-               ;;
         spu-*)
                os=-elf
                ;;
diff -u amanda-2.5.1p1/debian/po/templates.pot 
amanda-2.5.1p1/debian/po/templates.pot
--- amanda-2.5.1p1/debian/po/templates.pot
+++ amanda-2.5.1p1/debian/po/templates.pot
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
-"POT-Creation-Date: 2006-10-29 11:41-0700\n"
+"POT-Creation-Date: 2006-11-29 02:13+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
 "Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
diff -u amanda-2.5.1p1/debian/changelog amanda-2.5.1p1/debian/changelog
--- amanda-2.5.1p1/debian/changelog
+++ amanda-2.5.1p1/debian/changelog
@@ -1,3 +1,15 @@
+amanda (1:2.5.1p1-2.1) unstable; urgency=medium
+
+  * Non maintainer upload.
+  * Do not fail postrm when removing the backup user from either
+    group disk or tape does not succeed.  Also, try this only
+    when the backup user is in those groups to begin with.  Also
+    handles the case of deluser not existing anymore.
+    Based in parts on the patch provided by Andreas Henriksson and
+    the cupsys postinst script (closes: #399790).
+
+ -- Peter Palfrader <[EMAIL PROTECTED]>  Wed, 29 Nov 2006 01:57:01 +0100
+
 amanda (1:2.5.1p1-2) unstable; urgency=medium
 
   * fix broken way of setting default CLN_AMANDATES in client-src/clientconf.c
diff -u amanda-2.5.1p1/debian/postrm amanda-2.5.1p1/debian/postrm
--- amanda-2.5.1p1/debian/postrm
+++ amanda-2.5.1p1/debian/postrm
@@ -27,8 +27,17 @@
 
        rm -f ~backup/.amandahosts
 
-       deluser backup disk
-       deluser backup tape
+       if which deluser >/dev/null 2>&1 ; then
+               for group in disk tape; do
+                       # only call deluser when backup is in $group
+                       if getent group "$group" |
+                          awk -F: '{ print $4 }' |
+                          awk -F, '{ for (i=1; i <= NF; i++ ) print $i }' |
+                          grep '^backup$' > /dev/null; then
+                               deluser backup "$group" || true
+                       fi
+               done
+       fi
   ;;
   remove|upgrade|deconfigure)
   ;;

Reply via email to