[Pkg-lyx-devel] svn commit: r406 - in /lyx/trunk/debian: lyx-common.postrm lyx-common.preinst

hoaxter-guest at users.alioth.debian.org hoaxter-guest at users.alioth.debian.org
Mon Dec 10 16:26:12 UTC 2007


Author: hoaxter-guest
Date: Mon Dec 10 16:26:12 2007
New Revision: 406

URL: http://svn.debian.org/wsvn/pkg-lyx/?sc=1&rev=406
Log:
Advanced version of the /etc/lyxrc conffile removal

Modified:
    lyx/trunk/debian/lyx-common.postrm
    lyx/trunk/debian/lyx-common.preinst

Modified: lyx/trunk/debian/lyx-common.postrm
URL: http://svn.debian.org/wsvn/pkg-lyx/lyx/trunk/debian/lyx-common.postrm?rev=406&op=diff
==============================================================================
--- lyx/trunk/debian/lyx-common.postrm (original)
+++ lyx/trunk/debian/lyx-common.postrm Mon Dec 10 16:26:12 2007
@@ -1,9 +1,16 @@
 #!/bin/sh -e
 
-if [ "$1" = remove ]; then
-    if [ -x "`which texhash 2>/dev/null`" ]; then
-	texhash
-    fi
-fi
+case "$1" in
+    remove)
+	if [ -x "`which texhash 2>/dev/null`" ]; then
+	    texhash
+	fi
+	;;
+    purge)
+	if [ -f /etc/lyxrc ]; then
+	    rm -f /etc/lyxrc
+	fi
+	;;
+esac
 
 #DEBHELPER#

Modified: lyx/trunk/debian/lyx-common.preinst
URL: http://svn.debian.org/wsvn/pkg-lyx/lyx/trunk/debian/lyx-common.preinst?rev=406&op=diff
==============================================================================
--- lyx/trunk/debian/lyx-common.preinst (original)
+++ lyx/trunk/debian/lyx-common.preinst Mon Dec 10 16:26:12 2007
@@ -1,7 +1,29 @@
 #!/bin/sh -e
 
-if [ -f /etc/lyxrc ]; then
-    rm -f /etc/lyxrc
-fi
+# 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)
+	if dpkg --compare-versions "$2" le "1.5.2"; then
+            rm_conffile lyx-common "/etc/lyxrc"
+	fi
+esac
 
 #DEBHELPER#




More information about the Pkg-lyx-devel mailing list