tag 606788 + patch pending
thanks

On Sat, Dec 11, 2010 at 03:06:50PM -0800, Vagrant Cascadian wrote:
> this is due to a bug in the lenny version that's at least partially fixed in
> the version in squeeze:
> 
>   http://bugs.debian.org/582612
> 
> from the above bug report: 
> 
> "This is caused by the insane way wdm handles refreshing of wm list, it
> directly modifies entry in wdm-config everytime wdm is started or stopped.
> ...
> This will not prevent prompting when upgrading from previous versions, but
> should leave this problem addressed for the future."
> 
> so the squeeze version no longer has the bug that triggered the issue, but
> upgrades from older versions are going to suffer this issue.

Thanks for your comments.

As a matter of fact this is exactly the same problem than #582612.

When I prepared last wdm QA upload did not try to do a smooth upgrade since
I did not thought of a reasonable way at that time.

I have now thought of a possible approach for systems where changes were
never blessed by sysadmin in installation question (always decided to use
maintainer version). This will not affect config file if manually modified
by sysadmin.

Proposed wdm.preinst checks if the only change is display manager line and 
then checks if change was not blessed by sysadmin, reverting automatic 
changes if it was indeed not blessed and only automatically changed.

Proposed change is attached for comments before I prepare a new QA upload.

-- 
Agustin
>From 10b2dc3146dbff615de1f522063f0d8d0d7ffc20 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <agmar...@debian.org>
Date: Wed, 15 Dec 2010 12:54:56 +0100
Subject: [PATCH] debian/wdm.preinst: Smooth upgrades from lenny avoiding non-needed questions.

This should help in systems with no accepted changes.

wdm versions before 1.28-4 updated display manager list in ${wdmconfig}
conffile everytime wdm is installed, upgraded or run. That causes unneeded
queries during upgrade. This was fixed in 1.28-4. This file tries to smooth
upgrades from previous versions (1.28-2 and above). Checks if the only change
is display manager line and then checks if change was not blessed by sysadmin,
reverting automatic changes if so. See Debian bugs #582612 and #606788
---
 debian/changelog   |    8 ++++++++
 debian/wdm.preinst |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 debian/wdm.preinst

diff --git a/debian/changelog b/debian/changelog
index 4b5f0bf..503e800 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+wdm (1.28-5) unstable; urgency=low
+
+  * QA upload.
+  * RC: Smooth upgrades from lenny avoiding non-needed questions
+    in systems with no accepted changes (Closes: #606788).
+
+ -- Agustin Martin Domingo <agmar...@debian.org>  Wed, 15 Dec 2010 12:35:20 +0100
+
 wdm (1.28-4) unstable; urgency=low
 
   * QA upload.
diff --git a/debian/wdm.preinst b/debian/wdm.preinst
new file mode 100644
index 0000000..1d98f38
--- /dev/null
+++ b/debian/wdm.preinst
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+set -e
+
+# wdm versions before 1.28-4 updated display manager list in ${wdmconfig}
+# conffile everytime wdm is installed, upgraded or run. That causes unneeded
+# queries during upgrade. This was fixed in 1.28-4. This file tries to smooth
+# upgrades from previous versions (1.28-2 and above). Checks if the only change
+# is display manager line and then checks if change was not blessed by sysadmin,
+# reverting automatic changes if so. See Debian bugs #582612 and #606788
+
+# md5sums for pristine wdm-config with DisplayManager*wdmWm stripped
+# wdm_1.28-2 (as well as lenny wdm_1.28-3)
+pristine_stripped_md5="b903cf9c29cad13e3931ff30e6da7b96"
+# Intermediate wdm_1.28-3.5
+pristine_stripped_md5_alt="3ec0efa2089101552b0874ff63884292"
+
+# pristine wdm-config DisplayManager*wdmWm string
+pristine_string='! DisplayManager*wdmWm:         twm:wmaker:afterstep'
+
+wdmconfig="/etc/X11/wdm/wdm-config"
+wdmconfig_tmp="${wdmconfig}.dpkg-tmp"
+
+# Do nothing if this is first installation
+if [ -f "$wdmconfig" ]; then
+    wdmconfig_stripped_md5=$(grep -v 'DisplayManager\*wdmWm:' "${wdmconfig}" | md5sum  | sed 's/ .*//')
+
+    # First check if "$wdmconfig" matches old pristine files for everything but Displaymanager line.
+    if [ "$wdmconfig_stripped_md5" = "$pristine_stripped_md5" ] ||
+	[ "$wdmconfig_stripped_md5" = "$pristine_stripped_md5_alt" ]; then
+	wdmconfig_dpkg_md5sum=$(dpkg-query -W -f='${Conffiles}' wdm | grep "$wdmconfig" | awk '{print $2}')
+	sed -e 's/.*DisplayManager\*wdmWm:.*/'"$pristine_string"'/' "$wdmconfig" > "${wdmconfig_tmp}"
+	wdmconfig_new_md5=$(md5sum "${wdmconfig_tmp}" | sed 's/ .*//')
+
+	# Check now if re-created file md5 sum matches that registered by dpkg. Otherwise
+	# new file may have been explicitly accepted by sysadmin during upgrade.
+	if [ "$wdmconfig_new_md5" = "$wdmconfig_dpkg_md5sum" ]; then
+	    echo "Reverting unblessed automatic changes to ${wdmconfig}." >&2
+	    mv -f "${wdmconfig_tmp}" "$wdmconfig"
+	else
+	    rm -f "${wdmconfig_tmp}"
+	fi
+    fi
+fi
-- 
1.7.2.3

Reply via email to