[SCM] Mumudvb packaging branch, master, updated. 1.5.2-44-g851e6f1

Stephane Glondu steph at glondu.net
Sat Nov 15 21:56:37 UTC 2008


The following commit has been merged in the master branch:
commit 851e6f1e1f11cb6f019b18ba8568e3efd2e77988
Author: Stephane Glondu <steph at glondu.net>
Date:   Sat Nov 15 22:20:41 2008 +0100

    Add post{inst,rm} scripts for system user

diff --git a/debian/mumudvb.postinst b/debian/mumudvb.postinst
new file mode 100644
index 0000000..3d9c637
--- /dev/null
+++ b/debian/mumudvb.postinst
@@ -0,0 +1,75 @@
+#!/bin/sh
+# postinst script for mumudvb
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+# Some useful variables
+SYSTEM_USER="mumudvb"
+SYSTEM_HOME="/var/run/mumudvb"
+CHOWN="/bin/chown"
+USERADD="/usr/sbin/useradd"
+GROUPADD="/usr/sbin/groupadd"
+ID="/usr/bin/id"
+
+
+case "$1" in
+    configure)
+
+        # Get current uid and gid if user exists.
+        if $ID $SYSTEM_USER > /dev/null 2>&1; then
+            IUID=`$ID --user $SYSTEM_USER`
+            IGID=`$ID --group $SYSTEM_USER`
+        else
+            IUID="NONE"
+            IGID="NONE"
+        fi
+
+        # Ensure that no standard account or group remains before
+        # adding the new group/user.
+        if [ "$IUID" != "NONE" ] && [ $IUID -ge 1000 ]; then
+            echo "User $SYSTEM_USER already exists and is not a system user!"
+            exit 2
+        fi
+        if [ "$IGID" != "NONE" ] && [ $IGID -ge 1000 ]; then
+            echo "Group $SYSTEM_USER already exists and is not a system group!"
+            exit 2
+        fi
+
+        # Create group and user
+        $GROUPADD --system $SYSTEM_USER
+        $USERADD --system --home "$SYSTEM_HOME" --gid $SYSTEM_USER --no-user-group --shell /bin/false $SYSTEM_USER
+
+        # Change ownership of $SYSTEM_HOME
+        $CHOWN $SYSTEM_USER:$SYSTEM_USER -R "$SYSTEM_HOME"
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/mumudvb.postrm b/debian/mumudvb.postrm
new file mode 100644
index 0000000..2120778
--- /dev/null
+++ b/debian/mumudvb.postrm
@@ -0,0 +1,59 @@
+#!/bin/sh
+# postrm script for mumudvb
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+# Some useful variables
+SYSTEM_USER="mumudvb"
+SYSTEM_HOME="/var/run/mumudvb"
+USERDEL="/usr/sbin/userdel"
+GROUPDEL="/usr/sbin/groupdel"
+ID="/usr/bin/id"
+TRUE="/bin/true"
+
+
+case "$1" in
+    purge)
+
+        # Ensure $SYSTEM_HOME doesn't exist anymore
+        if [ -d "$SYSTEM_HOME" ]; then
+            echo "$SYSTEM_HOME still exists, check manually"
+            exit 2
+        fi
+
+        # Delete user and group
+        $USERDEL $SYSTEM_USER || $TRUE
+        $GROUPDEL $SYSTEM_USER || $TRUE
+
+    ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

-- 
Mumudvb packaging



More information about the pkg-vdr-dvb-changes mailing list