[SCM] mediatomb/master: move user creation scripts from preinst to postinst to avoid pre-dependency on adduser

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Thu Feb 24 20:40:39 UTC 2011


The following commit has been merged in the master branch:
commit ece41191116e70b18933b788441f45fb44b6099d
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Thu Feb 24 21:28:38 2011 +0100

    move user creation scripts from preinst to postinst to avoid pre-dependency on adduser

diff --git a/debian/mediatomb-daemon.postinst b/debian/mediatomb-daemon.postinst
index 7f22fa8..72e71cc 100644
--- a/debian/mediatomb-daemon.postinst
+++ b/debian/mediatomb-daemon.postinst
@@ -1,13 +1,7 @@
 #!/bin/sh -e
 
-if ! dpkg-statoverride --list /etc/mediatomb/config.xml >/dev/null 2>&1
-then
-	dpkg-statoverride --update --add mediatomb mediatomb 644 /etc/mediatomb/config.xml
-fi
-if ! dpkg-statoverride --list /var/lib/mediatomb >/dev/null 2>&1
-then
-	dpkg-statoverride --update --add mediatomb mediatomb 755 /var/lib/mediatomb
-fi
+DATADIR=/var/lib/mediatomb
+
 
 # Copies database file from sqlite3.db to mediatomb.db
 mv_db() {
@@ -18,6 +12,47 @@ mv_db() {
 
 case "$1" in
 configure)
+    # stolen from mysql deb package...
+    
+    # If we use NIS then errors should be tolerated. It's up to the
+    # user to ensure that the mediatomb user is correctly setup.
+    # Beware that there are two ypwhich one of them needs the 2>/dev/null!
+    if test -n "`which ypwhich 2>/dev/null`"  &&  ypwhich >/dev/null 2>&1; then
+        set +e
+    fi
+
+    # creating mediatomb group if it isn't already there
+    if ! getent group mediatomb >/dev/null; then
+        # Adding system group: mediatomb.
+        addgroup --system mediatomb >/dev/null
+    fi
+    
+    # creating mediatomb user if it isn't already there
+    if ! getent passwd mediatomb >/dev/null; then
+        # Adding system user: mediatomb.
+        adduser \
+         --system \
+         --ingroup mediatomb \
+         --home $DATADIR \
+         --gecos "MediaTomb Server" \
+         --shell /usr/sbin/nologin \
+         --disabled-login \
+         --disabled-password \
+         mediatomb  >/dev/null
+    fi
+    
+    # end of NIS tolerance zone
+    set -e
+    
+    if ! dpkg-statoverride --list /etc/mediatomb/config.xml >/dev/null 2>&1
+    then
+    	dpkg-statoverride --update --add mediatomb mediatomb 644 /etc/mediatomb/config.xml
+    fi
+    if ! dpkg-statoverride --list /var/lib/mediatomb >/dev/null 2>&1
+    then
+    	dpkg-statoverride --update --add mediatomb mediatomb 755 /var/lib/mediatomb
+    fi
+
     # Force removal of previous scripts if upgrading from 0.11.0-3
     if [ -n "$2" ] && dpkg --compare-versions "$2" le "0.11.0-3"; then
         update-rc.d mediatomb remove >/dev/null || exit $?
diff --git a/debian/mediatomb-daemon.preinst b/debian/mediatomb-daemon.preinst
deleted file mode 100644
index 34ce223..0000000
--- a/debian/mediatomb-daemon.preinst
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh -e
-
-DATADIR=/var/lib/mediatomb
-
-# stolen from mysql deb package...
-
-# If we use NIS then errors should be tolerated. It's up to the
-# user to ensure that the mediatomb user is correctly setup.
-# Beware that there are two ypwhich one of them needs the 2>/dev/null!
-if test -n "`which ypwhich 2>/dev/null`"  &&  ypwhich >/dev/null 2>&1; then
-    set +e
-fi
-
-# creating mediatomb group if it isn't already there
-if ! getent group mediatomb >/dev/null; then
-    # Adding system group: mediatomb.
-    addgroup --system mediatomb >/dev/null
-fi
-
-# creating mediatomb user if it isn't already there
-if ! getent passwd mediatomb >/dev/null; then
-    # Adding system user: mediatomb.
-    adduser \
-     --system \
-     --ingroup mediatomb \
-     --home $DATADIR \
-     --gecos "MediaTomb Server" \
-     --shell /usr/sbin/nologin \
-     --disabled-login \
-     --disabled-password \
-     mediatomb  >/dev/null
-fi
-
-# end of NIS tolerance zone
-set -e
-
-#DEBHELPER#
-
-exit 0

-- 
MediaTomb packaging



More information about the pkg-multimedia-commits mailing list