Hi Manuel,

On Mon, Apr 21, 2008 at 06:20:13PM +0200, Manuel Prinz wrote:
> 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,

Last time the bug was different:
"preinst failing if the user "slurm" does not
exist on the system while upgrading"

> because adduser returns 1 in this case. The attached
> patch fixes the issue for me.

The problem is with adduser beacuse in the "EXIT VALUES" section of the
manual page I read:
"Invoking adduser a second time with the same parameters as before also
returns 0."
and this is not to be happening.

> It's a little code duplication but working.

Patch was ok I only changed one thing that could break the script
execution, the new patch is attached.

On Mon, Apr 21, 2008 at 08:29:02PM +0200, Manuel Prinz wrote:
> Tested it with 1.2.27, works fine. I just don't get why this is an issue
> on the node that runs the controller daemon. The compute nodes don't
> seem to have this issue on upgrading. This is kinda weird. Can you
> reproduce this? Maybe it's just an issue in my setup... :-/

How is slurm user exported? What are its uid and gid?
Thanks for your help
-- 
Gennaro
--- preinst	2008-04-22 01:26:00.000000000 +0200
+++ preinst.new	2008-04-22 01:26:17.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,11 @@
         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
-      adduser --quiet --system --group --uid 64030 --no-create-home slurm
     ;;
 
     abort-upgrade)

Reply via email to