[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force X.Org X11 SVN commit: r508 - trunk/debian



Author: dnusinow
Date: 2005-08-08 09:49:04 -0500 (Mon, 08 Aug 2005)
New Revision: 508

Modified:
   trunk/debian/changelog
   trunk/debian/shell-lib.sh
   trunk/debian/xlibs.links
   trunk/debian/xlibs.postinst.in
   trunk/debian/xlibs.postrm.in
   trunk/debian/xlibs.preinst.in
Log:
* Introduce replace_conffile_with_symlink_{prepare,commit,rollback} 
  functions to debian/shell-lib.sh. Switch handling of symlinks to
  them.
* Add link from /etc/X11/xkb/rules/xorg.lst to
  /etc/X11/xkb/rules/xfree86.lst in xlibs.links. Add it to symlink
  handling.
* Add /etc/X11/xkb/rules/xfree86.xml symlink to symlink handling.
* Check old version of package in postrm in case of abort-install or
  abort-upgrade so we do not remove new config in the case of failed
  install/upgrade from not so old version. 


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/changelog	2005-08-08 14:49:04 UTC (rev 508)
@@ -48,6 +48,16 @@
     Closes: #318629
   * Re-enable building HTML docs
     - Remove patch general/057_X11.tmpl_warning_fix.diff to allow this
+  * Introduce replace_conffile_with_symlink_{prepare,commit,rollback} 
+    functions to debian/shell-lib.sh. Switch handling of symlinks to
+    them.
+  * Add link from /etc/X11/xkb/rules/xorg.lst to
+    /etc/X11/xkb/rules/xfree86.lst in xlibs.links. Add it to symlink
+    handling.
+  * Add /etc/X11/xkb/rules/xfree86.xml symlink to symlink handling.
+  * Check old version of package in postrm in case of abort-install or
+    abort-upgrade so we do not remove new config in the case of failed
+    install/upgrade from not so old version. 
 
   [ Julien Cristau ]
   * Clean up FAQ to refer to X.Org instead of XFree86. Closes: #319407

Modified: trunk/debian/shell-lib.sh
===================================================================
--- trunk/debian/shell-lib.sh	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/shell-lib.sh	2005-08-08 14:49:04 UTC (rev 508)
@@ -461,7 +461,7 @@
     exit $SHELL_LIB_USAGE_ERROR
   fi
 
-  conffile="$1"
+  _conffile="$1"
   shift
 
   # does the _conffile even exist?
@@ -535,6 +535,99 @@
   fi
 }
 
+replace_conffile_with_symlink_prepare () {
+  # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \
+  # official_md5sum ...
+  #
+  # Check a conffile "oldfilename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails. Otherwise copy it
+  # to newfilename and let dpkg handle it through conffiles mechanism.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  #local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 3 ]; then
+    usage_error "replace_conffile_with_symlink_prepare() called with wrong" \
+		" number of arguments; expected at least 3, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  _oldconffile="$1"
+  shift
+  _newconffile="$1"
+  shift
+
+  remove_conffile_prepare "$_oldconffile" "$@"
+  # If $_oldconffile still exists, then md5sums didn't match. 
+  # Copy it to new one.
+  if [ -f "$_oldconffile" ]; then
+    cp "$_oldconffile" "$_newconffile"
+  fi
+
+}
+
+replace_conffile_with_symlink_commit () {
+  # syntax: replace_conffile_with_symlink_commit oldfilename
+  #
+  # Complete the removal of a conffile "oldfilename" that has been 
+  # replaced by a symlink.
+  #
+  # Call this function from a postinst script after having used
+  # replace_conffile_with_symlink_prepare() in the preinst.
+
+  #local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "replace_conffile_with_symlink_commit() called with wrong" \
+		"number of arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  _conffile="$1"
+
+  remove_conffile_commit "$_conffile"
+}
+
+remove_conffile_rollback () {
+  # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename
+  #
+  # Roll back the replacing of a conffile "oldfilename" with symlink to
+  # "newfilename"
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" and verify $2 to ensure the package failed to upgrade
+  # from a version (or install over a version removed-but-not-purged) prior 
+  # to the one in which the conffile was obsoleted.
+  # You should have  used replace_conffile_with_symlink_prepare() in the 
+  # preinst.
+
+  #local conffile
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "replace_conffile_with_symlink_rollback() called with wrong" \
+		"number of arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  _oldconffile="$1"
+  _newconffile="$2"
+
+  remove_conffile_rollback "$_oldconffile"
+  if [ -f "$_newconffile" ]; then
+    rm "$_newconffile"
+  fi
+}
+
 run () {
   # syntax: run command [ argument ... ]
   #

Modified: trunk/debian/xlibs.links
===================================================================
--- trunk/debian/xlibs.links	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/xlibs.links	2005-08-08 14:49:04 UTC (rev 508)
@@ -1,3 +1,4 @@
 etc/X11/xkb/symbols/dvorak etc/X11/xkb/symbols/macintosh/dvorak
 etc/X11/xkb/rules/xorg.xml etc/X11/xkb/rules/xfree86.xml
+etc/X11/xkb/rules/xorg.lst etc/X11/xkb/rules/xfree86.lst
 etc/X11/xkb/rules/xorg etc/X11/xkb/rules/xfree86

Modified: trunk/debian/xlibs.postinst.in
===================================================================
--- trunk/debian/xlibs.postinst.in	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/xlibs.postinst.in	2005-08-08 14:49:04 UTC (rev 508)
@@ -17,5 +17,9 @@
 
 remove_conffile_commit /etc/X11/xkb/geometry/omnibook 
 remove_conffile_commit /etc/X11/xkb/symbols/ru_yawerty
-
+remove_conffile_commit /etc/X11/xkb/rules/xfree86-it.lst
+replace_conffile_with_symlink_commit /etc/X11/xkb/rules/xfree86
+replace_conffile_with_symlink_commit /etc/X11/xkb/rules/xfree86.lst 
+replace_conffile_with_symlink_commit /etc/X11/xkb/rules/xfree86.xml
+                   
 # vim:set ai et sts=2 sw=2 tw=80:

Modified: trunk/debian/xlibs.postrm.in
===================================================================
--- trunk/debian/xlibs.postrm.in	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/xlibs.postrm.in	2005-08-08 14:49:04 UTC (rev 508)
@@ -15,8 +15,17 @@
 #INCLUDE_SHELL_LIB#
 
 if [ "$1" = "abort-install" ] || [ "$1" = "abort-upgrade" ]; then
-  remove_conffile_rollback /etc/X11/xkb/geometry/omnibook
-  remove_conffile_rollback /etc/X11/xkb/symbols/ru_yawerty
+  if dpkg --compare-versions "$2" lt "6.8.1-0.3"; then
+    remove_conffile_rollback /etc/X11/xkb/geometry/omnibook
+    remove_conffile_rollback /etc/X11/xkb/symbols/ru_yawerty
+    remove_conffile_rollback /etc/X11/xkb/rules/xfree86-it.lst
+    replace_conffile_with_symlink_rollback /etc/X11/xkb/rules/xfree86 \
+    	/etc/X11/xkb/rules/xorg
+    replace_conffile_with_symlink_rollback /etc/X11/xkb/rules/xfree86.lst \
+    	/etc/X11/xkb/rules/xorg.lst
+    replace_conffile_with_symlink_rollback /etc/X11/xkb/rules/xfree86.xml \
+    	/etc/X11/xkb/rules/xorg.xml
+  fi
 fi
 
 #DEBHELPER#

Modified: trunk/debian/xlibs.preinst.in
===================================================================
--- trunk/debian/xlibs.preinst.in	2005-08-07 21:56:14 UTC (rev 507)
+++ trunk/debian/xlibs.preinst.in	2005-08-08 14:49:04 UTC (rev 508)
@@ -20,6 +20,14 @@
       99647d0d78564ac821c558d2bb7da714
     remove_conffile_prepare /etc/X11/xkb/symbols/ru_yawerty \
       b554dadb4877cfeb2cb38dd2531b3eb2
+    remove_conffile_prepare /etc/X11/xkb/rules/xfree86-it.lst \
+      4261329d61ba59549df77ff3734d086c
+    replace_conffile_with_symlink_prepare /etc/X11/xkb/rules/xfree86 \
+      /etc/X11/xkb/rules/xorg 82a80c3162b2254d69d84cbe3dfa9de6
+    replace_conffile_with_symlink_prepare /etc/X11/xkb/rules/xfree86.lst \
+      /etc/X11/xkb/rules/xorg.lst 72bb740887679a6c61530f49a52e0ec4
+    replace_conffile_with_symlink_prepare /etc/X11/xkb/rules/xfree86.xml \
+      /etc/X11/xkb/rules/xorg.xml d2cba1c74edbd1a3bce26e23fafcec9d
   fi
 fi
 



Reply to: