Bug#375689: Instructions on how to reconfigure xserver-xorg are incorrect
Hi,
I have attached a patch that is a first stab at solving these problems.
It requires more work by someone with more experience of the issues, but
it dies the basic of letting dpkg-reconfigure work if the md5sums match,
and not if they don't.
The first part of the patch migrates md5sums from the old locations,
this might want to be done for all of the related files.
The second part modifies the logic to try and accomplish what I think is
wanted.
Before it was
if upgrading from a specific version
if xorg.conf not modified
reconfigure and write file
else
update some paths etc
fi
fi
and now attempts to do
if xorg.conf not modified
reconfigure and write file
# under the assumption that the new paths will be written correctly
else
update the paths
fi
I hope I have the point of this section correct.
I have refrained from tagging the bug with +patch as the patch doesn't
solve the whole problem, please do this if appropriate.
Please contact me if you wish to discuss the patch further.
Thanks,
James
--
James Westby
jw+debian@jameswestby.net
http://jameswestby.net/
--- xserver-xorg.postinst.orig 2006-07-15 01:32:53.000000000 +0100
+++ xserver-xorg.postinst 2006-07-15 01:48:19.000000000 +0100
@@ -1081,6 +1081,12 @@
XORGCONFIG_ROSTER="$CONFIG_AUX_DIR/${XORGCONFIG##*/}.roster"
THIS_SERVER=/usr/bin/Xorg
+XORGCONFIG_CHECKSUM_OLD="/var/lib/xfree86/xorg.conf.md5sum"
+
+if [ -f $XORGCONFIG_CHECKSUM_OLD ]; then
+ mv $XORGCONFIG_CHECKSUM_OLD $XORGCONFIG_CHECKSUM
+fi
+
if [ -e "$CONFIG_AUX_DIR/.migrateconfig" ]; then
AUTODETECT_VIDEO="yes"
rm -f $CONFIG_AUX_DIR/.migrateconfig
@@ -1665,44 +1671,44 @@
warn "not updating $SERVER_SYMLINK; file exists but is not a symlink"
fi
-# here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
-if [ -z "$UPGRADE" ] || dpkg --compare-versions "$2" le "1:7.0.14"; then
- # compare the current and stored checksums; if they do not match, assume
- # that's the way the user wants it. if we're reconfiguring, overwrite
- # it regardless and back it up.
- if [ "$(md5sum "$XORGCONFIG")" = "$(cat "$XORGCONFIG_CHECKSUM")" ] || \
- ! [ -e "$XORGCONFIG" ] || [ -n "$RECONFIGURE" ]; then
- # they match or user deleted the file; prepare a new version
- NEW_XORGCONFIG="$XORGCONFIG.dpkg-new"
- if [ -n "$XRESPROBE_DEBUG" ]; then
- set -x
- fi
- xresprobeint
- if [ -n "$XRESPROBE_DEBUG" ]; then
- set +x
- fi
- if [ -n "$RECONFIGURE" ] && [ -e "$XORGCONFIG" ]; then
- BACKUP_XORGCONFIG="$XORGCONFIG.$(date '+%Y%m%d%H%M%S')"
- if [ -e "$BACKUP_XORGCONFIG" ]; then
- bomb "backup xorg.conf file $BACKUP_XORGCONFIG already" \
- "exists; please remove it and try again"
- fi
- cp "$XORGCONFIG" "$BACKUP_XORGCONFIG"
- warn "overwriting possibly-customised configuration file; backup" \
- "in $BACKUP_XORGCONFIG"
- fi
- if dexconf -o "$NEW_XORGCONFIG"; then
- if ! cmp -s "$XORGCONFIG" "$NEW_XORGCONFIG"; then
- mv "$NEW_XORGCONFIG" "$XORGCONFIG"
- md5sum "$XORGCONFIG" > "$XORGCONFIG_CHECKSUM"
- fi
- else
- warn "error while preparing new Xorg X server configuration" \
- "file in $NEW_XORGCONFIG; not attempting to update existing" \
- "configuration"
+# compare the current and stored checksums; if they do not match, assume
+# that's the way the user wants it. if we're reconfiguring, overwrite
+# it regardless and back it up.
+if [ "$(md5sum "$XORGCONFIG")" = "$(cat "$XORGCONFIG_CHECKSUM")" ] || \
+ ! [ -e "$XORGCONFIG" ] || [ -n "$RECONFIGURE" ]; then
+ # they match or user deleted the file; prepare a new version
+ NEW_XORGCONFIG="$XORGCONFIG.dpkg-new"
+ if [ -n "$XRESPROBE_DEBUG" ]; then
+ set -x
+ fi
+ xresprobeint
+ if [ -n "$XRESPROBE_DEBUG" ]; then
+ set +x
+ fi
+ if [ -n "$RECONFIGURE" ] && [ -e "$XORGCONFIG" ]; then
+ BACKUP_XORGCONFIG="$XORGCONFIG.$(date '+%Y%m%d%H%M%S')"
+ if [ -e "$BACKUP_XORGCONFIG" ]; then
+ bomb "backup xorg.conf file $BACKUP_XORGCONFIG already" \
+ "exists; please remove it and try again"
+ fi
+ cp "$XORGCONFIG" "$BACKUP_XORGCONFIG"
+ warn "overwriting possibly-customised configuration file; backup" \
+ "in $BACKUP_XORGCONFIG"
+ fi
+ if dexconf -o "$NEW_XORGCONFIG"; then
+ if ! cmp -s "$XORGCONFIG" "$NEW_XORGCONFIG"; then
+ mv "$NEW_XORGCONFIG" "$XORGCONFIG"
+ md5sum "$XORGCONFIG" > "$XORGCONFIG_CHECKSUM"
fi
- rm -f "$NEW_XORGCONFIG"
else
+ warn "error while preparing new Xorg X server configuration" \
+ "file in $NEW_XORGCONFIG; not attempting to update existing" \
+ "configuration"
+ fi
+ rm -f "$NEW_XORGCONFIG"
+else
+ # here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
+ if [ -z "$UPGRADE" ] || dpkg --compare-versions "$2" le "1:7.0.14"; then
# I'm going to get in so much shit for this...
BACKUP_XORGCONFIG="$XORGCONFIG.$(date '+%Y%m%d%H%M%S')"
warn "$XORGCONFIG has been customized, but we need to make updates. Backing up your config to $BACKUP_XORGCONFIG. If we screw something up, restore using this file."
@@ -1743,9 +1749,9 @@
chown --reference=$XORGCONFIG ${XORGCONFIG}.madwizard-new
chmod --reference=$XORGCONFIG ${XORGCONFIG}.madwizard-new
mv ${XORGCONFIG}.madwizard-new $XORGCONFIG
+ else
+ debug_echo "not updating $XORGCONFIG; we're upgrading"
fi
-else
- debug_echo "not updating $XORGCONFIG; we're upgrading"
fi
exit 0
Reply to: