tags 527381 + patch
thanks

On Thu, May 07, 2009 at 02:21:01PM +0200, Holger Levsen wrote:
>   Removing puppet ...
>   Purging configuration files for puppet ...
>   /var/lib/dpkg/info/puppet.postrm: line 6: deluser: command not found

The "deluser" command is in the non-essential "adduser" package.  The "puppet"
package assumes this is present on install and purge, which may not be the
case.

I've attached a patch to fix this by:

 * Moving adduser from Depends: to Pre-Depends

 * Checking if "userdel" and "groupdel" is available during purge, and only
   removing users if they are.

-- 
Stig Sandbeck Mathisen
diff --git a/debian/control b/debian/control
index 5a13529..0642f4c 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,8 @@ Homepage: http://reductivelabs.com/trac/puppet
 
 Package: puppet
 Architecture: all
-Depends: ruby (>= 1.8.1), libxmlrpc-ruby, libopenssl-ruby, libshadow-ruby1.8, adduser, facter, lsb-base
+Pre-Depends: adduser
+Depends: ruby (>= 1.8.1), libxmlrpc-ruby, libopenssl-ruby, libshadow-ruby1.8, facter, lsb-base
 Recommends: rdoc, libaugeas-ruby1.8
 Description: centralised configuration management for networks
  Puppet lets you centrally manage every important aspect of your system
diff --git a/debian/puppet.postrm b/debian/puppet.postrm
index b1156cf..86fb28b 100644
--- a/debian/puppet.postrm
+++ b/debian/puppet.postrm
@@ -3,8 +3,17 @@
 case "$1" in
     purge)
 	rm -rf /var/lib/puppet
-	deluser --system puppet
-	delgroup --system puppet
+	if [ -x "$(command -v deluser)" ]; then
+	    deluser --system puppet
+	else
+	    echo >&2 'Not removing system user "puppet" ("deluser" is not found)'
+	fi
+	
+	if [ -x "$(command -v delgroup)" ]; then
+	    delgroup --system puppet
+	else
+	    echo >&2 'Not removing system group "puppet" ("delgroup" is not found)'
+	fi
 	rm -f /etc/puppet/puppetd.conf
 	;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

Attachment: signature.asc
Description: Digital signature

Reply via email to