X Strike Force SVN commit: rev 454 - trunk/debian
Author: branden
Date: 2003-08-28 13:23:51 -0500 (Thu, 28 Aug 2003)
New Revision: 454
Modified:
trunk/debian/changelog
trunk/debian/xserver-xfree86.preinst.in
trunk/debian/xserver-xfree86.prerm.in
Log:
debian/xserver-xfree86.preinst.in: when installing (not upgrading)
xserver-xfree86*, point /etc/X11/X to the "true" executable which serves
as the "unconfigured" default; the postinst updates the symlink for the
debconf-indicated default X server
debian/xserver-xfree86.prerm.in: when removing the X server package
providing the target of the X server symlink (and that symlink is still
under automatic management), set the symlink target to the unconfigured
default (the path of the "true" executable) and update the checksum; this
ensures that an X server symlink under automatic management gets removed
from the system when the last package managing it is purged
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2003-08-28 15:46:55 UTC (rev 453)
+++ trunk/debian/changelog 2003-08-28 18:23:51 UTC (rev 454)
@@ -32,6 +32,9 @@
- if installing (not upgrading) the package, place the non-conffile
configuration files under automatic management, but only if they do not
already exist (Closes: #207268)
+ - when installing (not upgrading) xserver-xfree86*, point /etc/X11/X to
+ the "true" executable which serves as the "unconfigured" default; the
+ postinst updates the symlink for the debconf-indicated default X server
* debian/rules: stop calling debconf2po-update, per Denis Barbier
(Closes: #172579)
@@ -74,8 +77,15 @@
architectures that don't build the XFree86 X server, like s390; fixes
FTBFS on s390)
- -- Branden Robinson <branden@debian.org> Wed, 27 Aug 2003 22:16:59 -0500
+ * debian/xserver-xfree86.prerm.in: when removing the X server package
+ providing the target of the X server symlink (and that symlink is still
+ under automatic management), set the symlink target to the unconfigured
+ default (the path of the "true" executable) and update the checksum; this
+ ensures that an X server symlink under automatic management gets removed
+ from the system when the last package managing it is purged
+ -- Branden Robinson <branden@debian.org> Thu, 28 Aug 2003 13:17:07 -0500
+
xfree86 (4.2.1-10) unstable; urgency=medium
* patch #000_stolen_from_HEAD_xlib: fix for buffer overflow in
Modified: trunk/debian/xserver-xfree86.preinst.in
===================================================================
--- trunk/debian/xserver-xfree86.preinst.in 2003-08-28 15:46:55 UTC (rev 453)
+++ trunk/debian/xserver-xfree86.preinst.in 2003-08-28 18:23:51 UTC (rev 454)
@@ -22,6 +22,7 @@
SERVER_SYMLINK_CHECKSUM="$CONFIG_AUX_DIR/$(basename "$SERVER_SYMLINK").md5sum"
XF86CONFIG_CHECKSUM="$CONFIG_AUX_DIR/$(basename "$XF86CONFIG").md5sum"
THIS_SERVER=/usr/bin/X11/XFree86
+UNCONFIGURED_LINK_TARGET=$(which true)
if [ "$1" = "install" -o "$1" = "upgrade" ]; then
# create the configuration files' auxiliary directory if it doesn't exist
@@ -39,8 +40,8 @@
# first, create and checksum the X server symlink; only do this if it
# both does not exist and is not a symbolic link
if [ ! -e "$SERVER_SYMLINK" -a ! -L "$SERVER_SYMLINK" ]; then
- # $THIS_SERVER is just a default; could as easily be /bin/true
- ln -s "$THIS_SERVER" "$SERVER_SYMLINK"
+ # set the target to the unconfigured default
+ ln -s "$UNCONFIGURED_LINK_TARGET" "$SERVER_SYMLINK"
readlink "$SERVER_SYMLINK" | md5sum > "$SERVER_SYMLINK_CHECKSUM"
fi
# next, XF86Config-4
Modified: trunk/debian/xserver-xfree86.prerm.in
===================================================================
--- trunk/debian/xserver-xfree86.prerm.in 2003-08-28 15:46:55 UTC (rev 453)
+++ trunk/debian/xserver-xfree86.prerm.in 2003-08-28 18:23:51 UTC (rev 454)
@@ -21,7 +21,52 @@
#INCLUDE_SHELL_LIB#
+SERVER_SYMLINK=/etc/X11/X
+CONFIG_AUX_DIR=/var/lib/xfree86
+SERVER_SYMLINK_CHECKSUM="$CONFIG_AUX_DIR/$(basename "$SERVER_SYMLINK").md5sum"
+UNCONFIGURED_LINK_TARGET=$(which true)
+
if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
+ # if the X server symlink is under automatic management, we are removing its
+ # target; we must re-set it to its "unconfigured default"
+
+ # first, only mess with config files if the configuration file auxiliary
+ # directory exists; if it does not, assume that's the way the user wants it
+ if [ -d "$CONFIG_AUX_DIR" ]; then
+ # only mess with the server symlink file it exists and is actually a
+ # symlink; otherwise, assume that's the way the user wants it
+ if [ -L "$SERVER_SYMLINK" ]; then
+ # similarly, check for the existence of the checksum file; if it doesn't
+ # exist, assume that's the way the user wants it
+ if [ -e "$SERVER_SYMLINK_CHECKSUM" ]; then
+ # compare the current and stored checksums; if they do not match,
+ # assume that's the way the user wants it
+ if [ "$(readlink "$SERVER_SYMLINK" | md5sum)" = \
+ "$(cat "$SERVER_SYMLINK_CHECKSUM")" ]; then
+ # prepare a new version of the config file; this is a symlink, so we
+ # can't use the tempfile command for it (we'd have to subsequently
+ # use ln -sf, which is subject to race condition attacks)
+ NEW_SERVER_SYMLINK="$SERVER_SYMLINK.dpkg-new"
+ ln -sf "$UNCONFIGURED_LINK_TARGET" "$NEW_SERVER_SYMLINK"
+ if ! cmp -s "$SERVER_SYMLINK" "$NEW_SERVER_SYMLINK"; then
+ if [ "$(readlink "$SERVER_SYMLINK")" \
+ != "$(readlink "$NEW_SERVER_SYMLINK")" ]; then
+ if [ ! -d "$SERVER_SYMLINK" ]; then
+ message "Note: X server provided by $THIS_PACKAGE package is" \
+ "being removed; setting $SERVER_SYMLINK to point to" \
+ "$UNCONFIGURED_LINK_TARGET."
+ mv "$NEW_SERVER_SYMLINK" "$SERVER_SYMLINK"
+ readlink "$SERVER_SYMLINK" | md5sum > \
+ "$SERVER_SYMLINK_CHECKSUM"
+ fi
+ fi
+ fi
+ rm -f "$NEW_SERVER_SYMLINK"
+ fi
+ fi
+ fi
+ fi
+
if [ -n "$HAVE_DEBCONF" ]; then
# disown this question
db_unregister shared/default-x-server
Reply to: