Bug#389765: ippl: purging the package fails (adduser unavailable) (patch)

2006-09-30 Thread Vincent Zweije
Package: ippl
Version: 1.4.14-7
Severity: normal
Tags: patch

On Wed, Sep 27, 2006 at 05:11:49PM +0200, Bill Allombert wrote:

||  The postrm script cannot rely on adduser to be available when purging.

||  Unfortunately deluser does not understand the --home option.

Attached patch should fix the problems.

  * Remove --home option
  * Check availability of deluser

Please replace my email address in the changelog with whoever is going to
upload this.

Ciao.Vincent.
diff -rud ippl-1.4.14-7/debian/changelog ippl-1.4.14-7.1/debian/changelog
--- ippl-1.4.14-7/debian/changelog  2006-09-29 17:30:03.0 +0200
+++ ippl-1.4.14-7.1/debian/changelog2006-09-30 09:56:05.0 +0200
@@ -1,3 +1,10 @@
+ippl (1.4.14-7.1) unstable; urgency=low
+
+  * Accept missing deluser command and remove disappered --home argument in
+postrm.  (Closes: #389765)
+
+ -- Vincent Zweije <[EMAIL PROTECTED]>  Sun,  2 Oct 2005 18:37:12 +
+
 ippl (1.4.14-7) unstable; urgency=low
 
   * add upstream URL to package description
diff -rud ippl-1.4.14-7/debian/postinst ippl-1.4.14-7.1/debian/postinst
--- ippl-1.4.14-7/debian/postinst   2006-09-29 17:30:03.0 +0200
+++ ippl-1.4.14-7.1/debian/postinst 2006-09-30 11:03:35.489255638 +0200
@@ -20,9 +20,13 @@
 
 # Add user
 if [ "$1" = "configure" ]; then
-echo >&2 'Adding system user'
-adduser --system --group --home /var/run/ippl \
---disabled-login --force-badname $USERNAME
+if ! id -u $USERNAME >/dev/null 2>&1; then
+echo >&2 'Adding system user'
+adduser --system --group --home /var/run/ippl \
+--disabled-login --force-badname $USERNAME
+else
+echo >&2 "Re-using existing $USERNAME system user"
+fi
 fi
 
 #DEBHELPER#
diff -rud ippl-1.4.14-7/debian/postrm ippl-1.4.14-7.1/debian/postrm
--- ippl-1.4.14-7/debian/postrm 2006-09-29 17:30:03.0 +0200
+++ ippl-1.4.14-7.1/debian/postrm   2006-09-30 11:05:42.597082978 +0200
@@ -7,9 +7,11 @@
 #DEBHELPER#
 
 if [ "$1" = "purge" ]; then
-   rm -rf /var/log/ippl
-   
-   echo >&2 'Removing system user'
-   deluser --home $HOMEDIR --system $USERNAME
-   rm -rf $HOMEDIR
+rm -rf /var/log/ippl
+
+if which deluser >/dev/null; then
+echo >&2 'Removing system user'
+deluser --system $USERNAME
+rm -rf $HOMEDIR
+fi
 fi


Bug#389765: ippl: purging the package fails (adduser unavailable) (patch)

2006-09-30 Thread Marc Haber
tags #389765 confirmed pending
thanks

On Sat, Sep 30, 2006 at 11:25:00AM +0200, Vincent Zweije wrote:
> Attached patch should fix the problems.

Thanks for helping.

> diff -rud ippl-1.4.14-7/debian/postinst ippl-1.4.14-7.1/debian/postinst
> --- ippl-1.4.14-7/debian/postinst 2006-09-29 17:30:03.0 +0200
> +++ ippl-1.4.14-7.1/debian/postinst   2006-09-30 11:03:35.489255638 +0200
> @@ -20,9 +20,13 @@
>  
>  # Add user
>  if [ "$1" = "configure" ]; then
> -echo >&2 'Adding system user'
> -adduser --system --group --home /var/run/ippl \
> ---disabled-login --force-badname $USERNAME
> +if ! id -u $USERNAME >/dev/null 2>&1; then
> +echo >&2 'Adding system user'
> +adduser --system --group --home /var/run/ippl \
> +--disabled-login --force-badname $USERNAME
> +else
> +echo >&2 "Re-using existing $USERNAME system user"
> +fi
>  fi

I do not accept this patch as it replicates adduser features in the
maintainer scripts. adduser --system handles the case of the account
already existing in a graceful way.

> diff -rud ippl-1.4.14-7/debian/postrm ippl-1.4.14-7.1/debian/postrm
> --- ippl-1.4.14-7/debian/postrm   2006-09-29 17:30:03.0 +0200
> +++ ippl-1.4.14-7.1/debian/postrm 2006-09-30 11:05:42.597082978 +0200
> @@ -7,9 +7,11 @@
>  #DEBHELPER#
>  
>  if [ "$1" = "purge" ]; then
> - rm -rf /var/log/ippl
> - 
> - echo >&2 'Removing system user'
> - deluser --home $HOMEDIR --system $USERNAME
> - rm -rf $HOMEDIR
> +rm -rf /var/log/ippl
> +
> +if which deluser >/dev/null; then
> +echo >&2 'Removing system user'
> +deluser --system $USERNAME
> +rm -rf $HOMEDIR
> +fi
>  fi

I am invoking deluser --remove-home now from postinst:
if command -v deluser >/dev/null; then
  echo >&2 'Removing system user'
  deluser --remove-home --system $USERNAME
else
  echo >&2 'Not removing system user, deluser not found'
fi

The change is committed to svn.

Greetings
Marc

-- 
-
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]