[Pkg-utopia-commits] r1940 - in /packages/unstable/consolekit/debian: changelog consolekit.preinst

biebl at users.alioth.debian.org biebl at users.alioth.debian.org
Tue Dec 11 22:13:35 UTC 2007


Author: biebl
Date: Tue Dec 11 22:13:35 2007
New Revision: 1940

URL: http://svn.debian.org/wsvn/pkg-utopia/?sc=1&rev=1940
Log:
* debian/consolekit.preinst
  - Make sure the conffile /etc/init.d/consolekit and its symlinks in
    /etc/rc?.d are properly removed on package upgrades.

Added:
    packages/unstable/consolekit/debian/consolekit.preinst
Modified:
    packages/unstable/consolekit/debian/changelog

Modified: packages/unstable/consolekit/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/consolekit/debian/changelog?rev=1940&op=diff
==============================================================================
--- packages/unstable/consolekit/debian/changelog (original)
+++ packages/unstable/consolekit/debian/changelog Tue Dec 11 22:13:35 2007
@@ -12,8 +12,11 @@
     - Install the debian/org.freedesktop.ConsoleKit.service file into
       /usr/share/dbus-1/system-services. This allows to start the ConsoleKit
       service on demand.
+  * debian/consolekit.preinst
+    - Make sure the conffile /etc/init.d/consolekit and its symlinks in
+      /etc/rc?.d are properly removed on package upgrades.
 
- -- Michael Biebl <biebl at debian.org>  Tue, 11 Dec 2007 23:00:25 +0100
+ -- Michael Biebl <biebl at debian.org>  Tue, 11 Dec 2007 23:08:24 +0100
 
 consolekit (0.2.3-2) unstable; urgency=low
 

Added: packages/unstable/consolekit/debian/consolekit.preinst
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/consolekit/debian/consolekit.preinst?rev=1940&op=file
==============================================================================
--- packages/unstable/consolekit/debian/consolekit.preinst (added)
+++ packages/unstable/consolekit/debian/consolekit.preinst Tue Dec 11 22:13:35 2007
@@ -1,0 +1,61 @@
+#!/bin/sh -e
+# This script can be called in the following ways:
+#
+# Before the package is installed:
+#	<new-preinst> install
+#
+# Before removed package is upgraded:
+#	<new-preinst> install <old-version>
+#
+# Before the package is upgraded:
+#	<new-preinst> upgrade <old-version>
+#
+#
+# If postrm fails during upgrade or fails on failed upgrade:
+#	<old-preinst> abort-upgrade <new-version>
+
+
+# remove a no-longer used conffile
+rm_conffile()
+{
+    PKGNAME="$1"
+    CONFFILE="$2"
+
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+	    echo "Saving as $CONFFILE.dpkg-bak ..."
+            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+	else
+            echo "Removing obsolete conffile $CONFFILE ..." 
+	    rm -f "$CONFFILE" 
+	fi
+    fi
+}
+
+
+case "$1" in
+    install)
+    	;;
+
+    upgrade)
+	# Upgrade from previous versions
+	if dpkg --compare-versions "$2" lt "0.2.3-3"; then
+	    rm_conffile consolekit /etc/init.d/consolekit
+	    update-rc.d consolekit remove >/dev/null
+	fi
+	;;
+
+    abort-upgrade)
+	;;
+
+    *)
+	echo "$0 called with unknown argument \`$1'" 1>&2
+	exit 1
+	;;
+esac
+
+#DEBHELPER#
+exit 0




More information about the Pkg-utopia-commits mailing list