-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi all,

The attached debdiff fixes both postinst scripts so that they no
longer create a system user in /home on install. It also moves the
netdisco home directory to /var/lib/netdisco on upgrade. It will
delete the old directory if it is empty. If not, it simply notifies
the user as you suggest in your last comment on this bug. Here's the
upgrade part:

# Migrate home directory on upgrade from 1.0-1
if [ ! "$2" = "" ] && dpkg --compare-versions "$2" le 1.0-1; then
    echo "Moving system user netdisco's home directory to
/var/lib/netdisco"
    if [ -d /home/netdisco ] && ! rmdir /home/netdisco; then
        echo "Directory /home/netdisco is not empty. Not removing."
    fi
    usermod --home /var/lib/netdisco netdisco
fi

Let me know what you think. As this is an RC bug, if I don't hear any
response in a few days I will seek a sponsor for a NMU.

Thanks!

- - Andrew Starr-Bochicchio

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJQXPerAAoJEDtW4rvVP9yxnekQAJihzhXcaXYBA9HTM3r32xmT
/ftn5XBnjFbz49vjxHMmITQWEwnjyR88gzLt1nlOn53LBenvQc2TjPeTETbhfHXb
aFT4nIH2bsuCvc8/r1f5zveMkPwgPTtQYN9D7/cU5NdTrQ5uYYZjgfBPmE+L5CML
lm8+YBBr9qxicmAhdXhmxLokxPCN+uQLyHbLDF9azlHOC6mPaNZdSwV2LGkXu1OL
v3yaYze/teA9MkcmHBgOPVtoYr1naM6HL7eJsqC6Dxz2kuemuqQK1Z7XUO+LGcNa
ZH4qT2E54iETj1uoTrJk0QjDX3PRw13JMlz5i7gP+CyCvd0XiMy6+0681cgKLlOu
Kw1DFyHFkcqZKTczfzrZOobWDABM/K53SMcWJnP33y9D2gToKjo/Mwe9ig28E4Up
w9POh08CwRgbKy6Dqo3fe1B1B/LDe5F3SG2yr+ixX1IClvfvf6Cz/TOGPqmJEDFA
GeX4zQ6qHnZA0HZmmZfA6dYhO5KX+jApBpMLKMMaZT1px/qOMAdmX7+bY3Tk8Kyh
C5hcUKRhDH+tLr4WNlTLVQiYUKJ4BhITGWCyjpTijP29HX7FgMlGfnghrY4Rf1hh
9Cj05wDpSKcdGQJbEhaR2s4zkYCefAc/uuyLsIl7m1GAKQPZe10GlCCvXwMedPYg
tDP/aeSBjL0F7usDbC6w
=T/QP
-----END PGP SIGNATURE-----
diff -u netdisco-1.0/debian/netdisco-backend.postinst 
netdisco-1.0/debian/netdisco-backend.postinst
--- netdisco-1.0/debian/netdisco-backend.postinst
+++ netdisco-1.0/debian/netdisco-backend.postinst
@@ -27,7 +27,16 @@
         if ! getent passwd netdisco > /dev/null 2>&1 ; then
             adduser --quiet \
                 --system --disabled-login --ingroup netdisco \
-                --quiet --shell /bin/bash --home /home/netdisco netdisco
+                --no-create-home --home /var/lib/netdisco netdisco
+        fi
+
+        # Migrate home directory on upgrade from 1.0-1
+        if [ ! "$2" = "" ] && dpkg --compare-versions "$2" le 1.0-1; then
+            echo "Moving system user netdisco's home directory to 
/var/lib/netdisco"
+            if [ -d /home/netdisco ] && ! rmdir /home/netdisco; then
+                echo "Directory /home/netdisco is not empty. Not removing."
+            fi
+            usermod --home /var/lib/netdisco netdisco
         fi
 
         chown -R netdisco:netdisco /var/log/netdisco
diff -u netdisco-1.0/debian/changelog netdisco-1.0/debian/changelog
--- netdisco-1.0/debian/changelog
+++ netdisco-1.0/debian/changelog
@@ -1,3 +1,13 @@
+netdisco (1.0-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * debian/netdisco-{frontend, backend}.postinst:
+   - No longer create system user in /home (Closes: #668757).
+   - On upgrades, move system user's home directory to
+     /var/lib/netdisco
+
+ -- Andrew Starr-Bochicchio <a.star...@gmail.com>  Fri, 21 Sep 2012 17:19:35 
-0400
+
 netdisco (1.0-1) unstable; urgency=low
 
   [ Oliver Gorwits ]
diff -u netdisco-1.0/debian/netdisco-frontend.postinst 
netdisco-1.0/debian/netdisco-frontend.postinst
--- netdisco-1.0/debian/netdisco-frontend.postinst
+++ netdisco-1.0/debian/netdisco-frontend.postinst
@@ -27,7 +27,16 @@
         if ! getent passwd netdisco > /dev/null 2>&1 ; then
             adduser --quiet \
                 --system --disabled-login --ingroup netdisco \
-                --quiet --shell /bin/bash --home /home/netdisco netdisco
+                --no-create-home --home /var/lib/netdisco netdisco
+        fi
+
+        # Migrate home directory on upgrade from 1.0-1
+        if [ ! "$2" = "" ] && dpkg --compare-versions "$2" le 1.0-1; then
+            echo "Moving system user netdisco's home directory to 
/var/lib/netdisco"
+            if [ -d /home/netdisco ] && ! rmdir /home/netdisco; then
+                echo "Directory /home/netdisco is not empty. Not removing."
+            fi
+            usermod --home /var/lib/netdisco netdisco
         fi
 
         chown -R netdisco:www-data /var/lib/netdisco

Reply via email to