debian/changelog              |   11 +++++++
 debian/x11-common.postinst.in |   62 ++++++++++++++++--------------------------
 debian/x11-common.postrm.in   |   38 ++-----------------------
 debian/x11-common.preinst.in  |   46 -------------------------------
 4 files changed, 38 insertions(+), 119 deletions(-)

New commits:
commit e93304834e44bf1ad6c978185a8d4b2ce3ffff09
Author: Julien Cristau <jcris...@debian.org>
Date:   Fri Jan 28 12:49:02 2011 +0100

    x11-common: drop usage of /var/lib/x11/Xwrapper.config.{md5sum,roster}.
    
    Since sarge (I think), no other package has been handling
    /etc/X11/Xwrapper.config, so assume we're the only owner, remove the
    state files on upgrade.  The checksum is also not needed, we read the
    allowed_users value from the file in the config script and preserve it.

diff --git a/debian/changelog b/debian/changelog
index ffa76a9..9aa0a0b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+xorg (1:7.6~3) UNRELEASED; urgency=low
+
+  * x11-common: drop usage of /var/lib/x11/Xwrapper.config.{md5sum,roster}.
+    Since sarge (I think), no other package has been handling
+    /etc/X11/Xwrapper.config, so assume we're the only owner, remove the state
+    files on upgrade.  The checksum is also not needed, we read the
+    allowed_users value from the file in the config script and preserve it.
+    Closes: #611271.
+
+ -- Julien Cristau <jcris...@debian.org>  Fri, 28 Jan 2011 12:40:27 +0100
+
 xorg (1:7.6~2) experimental; urgency=low
 
   * Drop xserver-xorg-video-nv, it's no longer supported.
diff --git a/debian/x11-common.postinst.in b/debian/x11-common.postinst.in
index abe2301..323d56c 100644
--- a/debian/x11-common.postinst.in
+++ b/debian/x11-common.postinst.in
@@ -21,35 +21,17 @@ 
XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_ROSTER_BASE"
 
 #INCLUDE_SHELL_LIB#
 
-# register this package as a (potential) handler of the X server wrapper
-# config file
-if ! fgrep -qsx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER"; then
-  echo "$THIS_PACKAGE" >> "$XWRAPPER_CONFIG_ROSTER"
-fi
-
-if ! [ -d "$CONFIG_AUX_DIR" ]; then
-  mkdir --mode=755 --parents "$CONFIG_AUX_DIR"
-fi
-
 # only mess with config file it exists; otherwise, assume that's the way the
 # user wants it, but only if upgrading
 if [ -e "$XWRAPPER_CONFIG" ] || [ -z "$UPGRADE" ]; then
-  # similarly, check for the existence of the checksum file; if it doesn't
-  # exist, assume that's the way the user wants it, but only if upgrading
-  if [ -e "$XWRAPPER_CONFIG_CHECKSUM" ] || [ -z "$UPGRADE" ]; then
-    # next, compare the current and stored checksums; if they do not match,
-    # assume that's the way the user wants it ... upgrading etc
-    if [ "$(md5sum "$XWRAPPER_CONFIG" 2>/dev/null)" = \
-         "$(cat "$XWRAPPER_CONFIG_CHECKSUM" 2>/dev/null)" ] || \
-        [ -z "$UPGRADE" ]; then
-      # they match; prepare a new version of the config file
-      ALLOWED_USERS=
-      if db_get x11-common/xwrapper/actual_allowed_users; then
-        ALLOWED_USERS="$RET"
-      fi
-      if [ -n "$ALLOWED_USERS" ]; then
-        NEW_XWRAPPER_CONFIG=$(tempfile)
-        cat >>"$NEW_XWRAPPER_CONFIG" << EOF
+  ALLOWED_USERS=
+  if db_get x11-common/xwrapper/actual_allowed_users; then
+    ALLOWED_USERS="$RET"
+  fi
+  if [ -n "$ALLOWED_USERS" ]; then
+    NEW_XWRAPPER_CONFIG=$(tempfile)
+    if ! [ -e "$XWRAPPER_CONFIG" ]; then
+      cat >>"$NEW_XWRAPPER_CONFIG" << EOF
 # Xwrapper.config (Debian X Window System server wrapper configuration file)
 #
 # This file was generated by the post-installation script of the x11-common
@@ -65,26 +47,30 @@ if [ -e "$XWRAPPER_CONFIG" ] || [ -z "$UPGRADE" ]; then
 #   dpkg-reconfigure x11-common
 allowed_users=$ALLOWED_USERS
 EOF
-        if ! cmp -s "$XWRAPPER_CONFIG" "$NEW_XWRAPPER_CONFIG"; then
-          cp "$NEW_XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-new"
-          mv "$XWRAPPER_CONFIG.dpkg-new" "$XWRAPPER_CONFIG"
-          md5sum "$XWRAPPER_CONFIG" > "$XWRAPPER_CONFIG_CHECKSUM"
-        fi
-        rm -f "$NEW_XWRAPPER_CONFIG"
-      else
-        observe "not updating $XWRAPPER_CONFIG; problems communicating" \
-                "with debconf database"
-      fi
     else
-      observe "not updating $XWRAPPER_CONFIG; file has been customized"
+      sed -e '/^allowed_users.*/d' < "$XWRAPPER_CONFIG" > 
"$NEW_XWRAPPER_CONFIG"
+      echo "allowed_users=$ALLOWED_USERS" >> "$NEW_XWRAPPER_CONFIG"
+      if ! cmp -s "$XWRAPPER_CONFIG" "$NEW_XWRAPPER_CONFIG"; then
+        cp "$NEW_XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-new"
+        mv "$XWRAPPER_CONFIG.dpkg-new" "$XWRAPPER_CONFIG"
+      fi
     fi
+    rm -f "$NEW_XWRAPPER_CONFIG"
   else
-    observe "not updating $XWRAPPER_CONFIG; no stored checksum available"
+    observe "not updating $XWRAPPER_CONFIG; problems communicating" \
+      "with debconf database"
   fi
 else
   observe "not updating $XWRAPPER_CONFIG; file does not exist"
 fi
 
+# get rid of obsolete X server wrapper config roster and checksum
+if dpkg --compare-versions "$2" lt-nl 1:7.6~3; then
+  rm -f "$XWRAPPER_CONFIG_ROSTER"
+  rm -f "$XWRAPPER_CONFIG_CHECKSUM"
+  rmdir "$CONFIG_AUX_DIR" 2>/dev/null || :
+fi
+
 if dpkg --compare-versions "$2" lt-nl 1:7.4+2; then
   db_unregister x11-common/xwrapper/nice_value || :
   db_unregister x11-common/xwrapper/nice_value/error || :
diff --git a/debian/x11-common.postrm.in b/debian/x11-common.postrm.in
index 22bf8b8..1202d23 100644
--- a/debian/x11-common.postrm.in
+++ b/debian/x11-common.postrm.in
@@ -20,41 +20,9 @@ 
XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/${XWRAPPER_CONFIG##*/}.roster"
 
 # clean up non-conffile configuration files and related materials on purge
 if [ "$1" = "purge" ]; then
-  # de-register this package as a handler of the X server wrapper config file
-  if [ -e "$XWRAPPER_CONFIG_ROSTER" ]; then
-    # check existing roster file for our package name
-    if fgrep -qx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER" 2>/dev/null; then
-      # construct temporary roster file with our package name removed, ignoring
-      # failure
-      fgrep -vx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER" > \
-        "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" 2>/dev/null || true
-      # is there anything left?
-      if [ -s "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" ]; then
-        # yes, replace the roster file
-        mv "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" "$XWRAPPER_CONFIG_ROSTER"
-      else
-        # no; remove both the roster and our temporary copy
-        rm -f "$XWRAPPER_CONFIG_ROSTER" "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp"
-        # remove X server wrapper config file if it was still managed by the
-        # package
-        if [ -e "$XWRAPPER_CONFIG_CHECKSUM" ]; then
-          # does it exist?
-          if [ -e "$XWRAPPER_CONFIG" ]; then
-            # does the current MD5 checksum match the stored checksum?
-            if [ "$(md5sum "$XWRAPPER_CONFIG")" \
-                 = "$(cat "$XWRAPPER_CONFIG_CHECKSUM")" ]; then
-              # yes; remove the config file
-              rm -f "$XWRAPPER_CONFIG"
-            fi
-          fi
-          # remove the checksum file; any remaining X server wrapper config 
file
-          # still on the system at this point is no longer being managed (local
-          # user customization)
-          rm -f "$XWRAPPER_CONFIG_CHECKSUM"
-        fi
-      fi
-    fi
-  fi
+  rm -f "$XWRAPPER_CONFIG_ROSTER"
+  rm -f "$XWRAPPER_CONFIG"
+  rm -f "$XWRAPPER_CONFIG_CHECKSUM"
 
   for DIR in "$CONFIG_DIR" "$CONFIG_AUX_DIR"; do
       rmdir "$DIR" 2> /dev/null || true
diff --git a/debian/x11-common.preinst.in b/debian/x11-common.preinst.in
deleted file mode 100644
index cee5b13..0000000
--- a/debian/x11-common.preinst.in
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-# Debian x11-common package pre-installation script
-# Copyright 1998--2001, 2003 Branden Robinson.
-# Licensed under the GNU General Public License, version 2.  See the file
-# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
-# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-THIS_PACKAGE=x11-common
-THIS_SCRIPT=preinst
-CONFIG_DIR=/etc/X11
-XWRAPPER_CONFIG="$CONFIG_DIR/Xwrapper.config"
-CONFIG_AUX_DIR=/var/lib/x11
-XWRAPPER_CONFIG_ROSTER_BASE="${XWRAPPER_CONFIG##*/}.roster"
-XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_ROSTER_BASE"
-XWRAPPER_CONFIG_CHECKSUM_BASE="${XWRAPPER_CONFIG##*/}.md5sum"
-XWRAPPER_CONFIG_CHECKSUM="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_CHECKSUM_BASE"
-
-#INCLUDE_SHELL_LIB#
-
-if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
-
-  # create the configuration files' main and auxiliary directories if they
-  # don't exist
-  for DIR in "$CONFIG_DIR" "$CONFIG_AUX_DIR"; do
-    if ! [ -e "$DIR" ]; then
-      observe "creating $DIR"
-      mkdir --mode=755 --parents "$DIR"
-    fi
-  done
-
-  # place config files under management if they do *not* already exist
-  if ! [ -e "$XWRAPPER_CONFIG" ]; then
-    touch "$XWRAPPER_CONFIG"
-    md5sum "$XWRAPPER_CONFIG" > "$XWRAPPER_CONFIG_CHECKSUM"
-  fi
-fi
-
-#DEBHELPER#
-
-exit 0
-
-# vim:set ai et sts=2 sw=2 tw=0:


-- 
To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1pin1m-0000o0...@alioth.debian.org

Reply via email to