Package: slurm-llnl
Version: 1.2.27-1
Followup-For: Bug #459618

Hi Gennaro,

I encountered this bug again. I have not upgraded for a while so I did not
notice it. The package fails to install on upgrade and install if the user
"slurm" already exists, because adduser returns 1 in this case. The attached
patch fixes the issue for me. It's a little code duplication but working.
Maybe there's an easier way to do it (besides "adduser ... || true"). I just
tested the package with 1.2.25 but it works for me and I think it will work
with later versions of the package as well.

Best regards
Manuel

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (200, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
--- debian/preinst.orig 2008-04-21 17:06:05.000000000 +0200
+++ debian/preinst      2008-04-21 17:49:25.000000000 +0200
@@ -17,7 +17,16 @@
 
 case "$1" in
     install)
-      adduser --quiet --system --group --uid 64030 --no-create-home slurm
+      if [ $(id -u slurm 2>/dev/null) ]; then
+        SLURMUID=$(id -u slurm 2>/dev/null)
+        SLURMGID=$(id -g slurm 2>/dev/null)
+        if [ "$SLURMUID" != "64030" ] || [ "$SLURMGID" != "64030" ] ; then
+          deluser --quiet slurm
+          adduser --quiet --system --group --uid 64030 --no-create-home slurm
+        fi
+      else
+        adduser --quiet --system --group --uid 64030 --no-create-home slurm
+      fi
     ;;
 
     upgrade)
@@ -26,9 +35,9 @@
         SLURMGID=$(id -g slurm 2>/dev/null)
         if [ "$SLURMUID" != "64030" ] || [ "$SLURMGID" != "64030" ] ; then
           deluser --quiet slurm
+          adduser --quiet --system --group --uid 64030 --no-create-home slurm
         fi
       fi
-      adduser --quiet --system --group --uid 64030 --no-create-home slurm
     ;;
 
     abort-upgrade)

Reply via email to