Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
[privoxy.git] / debian / postinst
index 8f1028d..5bc965b 100644 (file)
@@ -25,11 +25,15 @@ set -e
 
 case "$1" in
     configure)
-        if ! grep -q '^privoxy:' /etc/passwd
+        if ! adduser --quiet --system --home /etc/privoxy --no-create-home \
+                    --ingroup nogroup --disabled-password privoxy
         then
-            adduser --system --home /etc/privoxy --ingroup nogroup \
-                    --disabled-password privoxy >/dev/null
-        fi
+           # user privoxy seems to exist
+           # -> remove him before newly adding him.
+           deluser --quiet privoxy
+           adduser --quiet --system --home /etc/privoxy --no-create-home \
+                   --ingroup nogroup --disabled-password privoxy
+       fi
         chown -R privoxy.adm /var/log/privoxy
         chmod 750 /var/log/privoxy
        chown privoxy /etc/privoxy/*.action /etc/privoxy/trust