X Strike Force XFree86 SVN commit: r1261 - in trunk/debian: . local
Author: branden
Date: 2004-04-15 15:33:10 -0500 (Thu, 15 Apr 2004)
New Revision: 1261
Modified:
trunk/debian/changelog
trunk/debian/local/xdm.options
trunk/debian/local/xdm.options.5
trunk/debian/xdm.postinst.in
trunk/debian/xdm.postrm.in
trunk/debian/xdm.preinst.in
trunk/debian/xdm.prerm.in
Log:
Improve xdm package's maintainer scripts:
+ Add capability to start the daemon on package install, controlled by the
"start-on-install" flag in /etc/X11/xdm/xdm.options (which defaults
off). Update xdm.options(5) manpage to document this option and explain
why it defaults off.
+ Replace "upgrade" flag file with two distinct ones, "install" and
"daemon-not-stopped". Create install flag file when preinst script is
invoked with "install" argument; remove in postinst, and in postrm when
invoked with "abort-install" or "abort-upgrade" argument. Create
"daemon-not-stopped" flag file in prerm script if the daemon is not
stopped with invoke-rc.d; remove in postinst, and in postrm when invoked
with "abort-upgrade" argument.
+ Make the logic deciding whether or not to start the daemon more
sophisticated. After determining the user's intentions via the
xdm.options file, check to see if the daemon is already running, and
record its pid. If it isn't, check xdm's Xservers file to see if we would
be starting an X server on the current display. If either of these is the
case, refuse to start the daemon and issue a warning message explaining
why.
+ Duplicate relevant logic from the postinst script logic in the postrm
when invoked with the "abort-upgrade" argument; this way the daemon is
restarted if it was stopped for upgrade, but the upgrade failed.
+ Pass package name literally to update-rc.d and invoke-rc.d; quiets
lintian warning.
+ Call db_stop before update-rc.d; if the latter spews to stdout, it can
confuse debconf.
+ Use shell's && and || operators instead of test(1)'s -a and -o
operators, since the former is POSIX-compliant and the latter is not.
+ Update copyright notices.
+ Update Vim modelines.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/changelog 2004-04-15 20:33:10 UTC (rev 1261)
@@ -211,8 +211,37 @@
+ Use shell's && and || operators instead of test(1)'s -a and -o
operators, since the former is POSIX-compliant and the latter is not.
- -- Branden Robinson <branden@debian.org> Thu, 15 Apr 2004 15:11:17 -0500
+ * Improve xdm package's maintainer scripts:
+ + Add capability to start the daemon on package install, controlled by the
+ "start-on-install" flag in /etc/X11/xdm/xdm.options (which defaults
+ off). Update xdm.options(5) manpage to document this option and explain
+ why it defaults off.
+ + Replace "upgrade" flag file with two distinct ones, "install" and
+ "daemon-not-stopped". Create install flag file when preinst script is
+ invoked with "install" argument; remove in postinst, and in postrm when
+ invoked with "abort-install" or "abort-upgrade" argument. Create
+ "daemon-not-stopped" flag file in prerm script if the daemon is not
+ stopped with invoke-rc.d; remove in postinst, and in postrm when invoked
+ with "abort-upgrade" argument.
+ + Make the logic deciding whether or not to start the daemon more
+ sophisticated. After determining the user's intentions via the
+ xdm.options file, check to see if the daemon is already running, and
+ record its pid. If it isn't, check xdm's Xservers file to see if we
+ would be starting an X server on the current display. If either of
+ these is the case, refuse to start the daemon and issue a warning
+ message explaining why.
+ + Duplicate relevant logic from the postinst script logic in the postrm
+ when invoked with the "abort-upgrade" argument; this way the daemon is
+ restarted if it was stopped for upgrade, but the upgrade failed.
+ + Pass package name literally to update-rc.d and invoke-rc.d; quiets
+ lintian warning.
+ + Call db_stop before update-rc.d; if the latter spews to stdout, it can
+ confuse debconf.
+ + Use shell's && and || operators instead of test(1)'s -a and -o
+ operators, since the former is POSIX-compliant and the latter is not.
+ -- Branden Robinson <branden@debian.org> Thu, 15 Apr 2004 15:29:22 -0500
+
xfree86 (4.3.0-7) unstable; urgency=medium
* Urgency due to fix for FTBFS. Yes -- I too am begging for it to stop.
Modified: trunk/debian/local/xdm.options
===================================================================
--- trunk/debian/local/xdm.options 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/local/xdm.options 2004-04-15 20:33:10 UTC (rev 1261)
@@ -1,8 +1,9 @@
-# /etc/X11/xdm.options
+# $Id$
#
# configuration options for xdm
# See xdm.options(5) for an explanation of the available options.
no-ignore-nologin
no-restart-on-upgrade
+no-start-on-install
use-sessreg
Modified: trunk/debian/local/xdm.options.5
===================================================================
--- trunk/debian/local/xdm.options.5 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/local/xdm.options.5 2004-04-15 20:33:10 UTC (rev 1261)
@@ -15,7 +15,7 @@
.\" the Debian operating system, in /usr/share/common-licenses/GPL; if
.\" not, write to the Free Software Foundation, Inc., 59 Temple Place,
.\" Suite 330, Boston, MA 02111-1307 USA
-.TH xdm.options 5 "2004\-04\-13" "Debian Project"
+.TH xdm.options 5 "2004\-04\-15" "Debian Project"
.SH NAME
xdm.options \- configuration options for X display manager
.SH DESCRIPTION
@@ -59,11 +59,27 @@
pre\-removal script checks to see if the xdm process has any children; if
it does, it is possible that someone's session would be killed by stopping
xdm, so a warning is issued and an opportunity to abort the upgrade of xdm
-is provided. If this option is disabled (the Debian default), xdm will be
-not be stopped or started during an install or upgrade; the administrator
-will have to do so by hand (with \(oqinvoke-rc.d xdm restart\(cq, or by
-rebooting the system) before the newly installed xdm binary is used.
+is provided. Furthermore, restarting xdm on upgrade can be surprising,
+because a locally\-managed X server can change the active VT even while
+other packages are continuing to upgrade. If, by intent or accident, the X
+server does not honor the key sequence to switch VTs back to a virtual
+console, this can be undesirable. If this option is disabled (the Debian
+default), xdm will be not be stopped or started during an upgrade of its
+package; the administrator will have to do so by hand (with \(oqinvoke-rc.d
+xdm restart\(cq, or by rebooting the system) before the newly installed xdm
+binary is used.
.TP
+.B start\-on\-install
+Enable this option with caution; it causes the xdm daemon to be started
+immediately after the package is installed. See the above entry regarding
+.B restart\-on\-upgrade
+for other caveats regarding the consequences of starting the xdm daemon
+during package management. If this option is disabled (the Debian
+default), xdm will not be started when it is installed. Changing this
+setting can affect future installs if the package is removed, but not
+purged (which removes \(oqconffiles\(cq, including
+.IR xdm.options ).
+.TP
.B use\-sessreg
If this option is enabled (the Debian default), the sessreg program will be
invoked to register X sessions managed by xdm in the utmp and wtmp files.
Modified: trunk/debian/xdm.postinst.in
===================================================================
--- trunk/debian/xdm.postinst.in 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/xdm.postinst.in 2004-04-15 20:33:10 UTC (rev 1261)
@@ -1,6 +1,6 @@
#!/bin/sh
# Debian xdm package post-installation script
-# Copyright 1998--2001, 2003 Branden Robinson.
+# Copyright 1998--2001, 2003, 2004 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.
@@ -20,7 +20,8 @@
check_symlinks_and_bomb /usr/X11R6/lib/X11/xdm
# now safe to remove old xserver dir
-if [ -e /usr/X11R6/lib/X11/xdm.moved-by-preinst -a -L /usr/X11R6/lib/X11/xdm ]; then
+if [ -e /usr/X11R6/lib/X11/xdm.moved-by-preinst ] \
+ && [ -L /usr/X11R6/lib/X11/xdm ]; then
rm -r /usr/X11R6/lib/X11/xdm.moved-by-preinst
fi
@@ -65,56 +66,86 @@
rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
fi
-# restarting the daemon may cause output to stdout
-run db_stop
+# Registering the init scripts or starting the daemon may cause output to
+# stdout, which can confuse debconf.
+db_stop
-# don't start xdm if we are upgrading without stopping it
+if [ -e /etc/init.d/xdm ]; then
+ update-rc.d xdm defaults 99 01
+fi
+
+# Whether we are installing or upgrading, we check the options file to see if
+# the user wants the daemon (re-)started.
NOSTART=
-XDM_RUNNING=
-if [ -e /var/run/xdm.upgrade ]; then
- NOSTART=yes
-fi
-# or if we're currently in X on the display it attempts to manage by default
-for HOST in "" \
- "localhost" \
- "$(hostname 2> /dev/null)" \
- "$(hostname -f 2> /dev/null)"; do
- if echo "$DISPLAY" | grep -q "^$HOST:0.*"; then
+XDM_WHERE=
+if [ -e /var/run/xdm.install ]; then
+ # Don't start the daemon if the options file says not to.
+ if ! grep -qs ^start-on-install /etc/X11/xdm/xdm.options; then
NOSTART=yes
- break
fi
-done
-# or if it's already running
+else
+ # We are upgrading. Don't start the daemon if it wasn't stopped...
+ if [ -e /var/run/xdm.daemon-not-stopped ]; then
+ NOSTART=yes
+ fi
+ # ...or if the options file says not to.
+ if ! grep -qs ^restart-on-upgrade /etc/X11/xdm/xdm.options; then
+ NOSTART=yes
+ fi
+fi
+
+# At this point we may think we *should* be starting the daemon, but we need to
+# do some more checks. Clean up the old, obsolete /var/state/xdm directory
+# (which we can only do if the daemon isn't running).
+
+DENYSTART=
+# Don't start the daemon if it's already running...
if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/xdm.pid \
--exec /usr/bin/X11/xdm; then
- NOSTART=yes
- XDM_RUNNING=yes
-fi
-# or if the options file says not to
-if ! grep -qs ^restart-on-upgrade /etc/X11/xdm/xdm.options; then
- NOSTART=yes
-fi
-
-if [ -n "$XDM_RUNNING" ]; then
+ # Note our refusal to start the daemon if we were supposed to start it.
+ [ -n "$NOSTART" ] || DENYSTART=yes
+ XDM_WHERE="pid $(cat /var/run/xdm.pid)"
if [ -d /var/state/xdm ]; then
warn "obsolete directory /var/state/xdm cannot be removed because xdm is" \
- "still running; reinstall the xdm package (or remove the directory" \
- "manually) when xdm is not running"
+ "still running at $XDM_WHERE; reinstall the xdm package (or remove" \
+ "the directory manually) when xdm is not running"
fi
else
if [ -d /var/state/xdm ]; then
rm -r /var/state/xdm
fi
+ # ...or if we're currently in X on any of the displays it attempts to manage
+ # by default.
+ if [ -s /etc/X11/xdm/Xservers ]; then
+ MANAGED_DISPLAYS="$(egrep -v '^[[:space:]]*#' /etc/X11/xdm/Xservers \
+ | sed 's/[[:space:]].*//')"
+ if [ -n "$MANAGED_DISPLAYS" ]; then
+ for MANAGED_DISPLAY in $MANAGED_DISPLAYS; do
+ if echo "$DISPLAY" | grep -q "^$MANAGED_DISPLAY"; then
+ # Note our refusal to start the daemon if we were supposed to start
+ # it.
+ [ -n "$NOSTART" ] || DENYSTART=yes
+ XDM_WHERE="$DISPLAY, which xdm will attempt to manage"
+ break
+ fi
+ done
+ fi
+ fi
fi
-if [ -e /etc/init.d/xdm ]; then
- update-rc.d "$THIS_PACKAGE" defaults 99 01
+# If the user wanted us to start the daemon but we refuse, explain why.
+if [ -n "$DENYSTART" ]; then
+ warn "not starting xdm because it is already running at $XDM_WHERE"
+ NOSTART=yes
fi
-[ -n "$NOSTART" ] || invoke-rc.d "$THIS_PACKAGE" start || true
+[ -n "$NOSTART" ] || invoke-rc.d xdm start || true
#DEBHELPER#
+# Remove flag files.
+rm -f /var/run/xdm.install /var/run/xdm.daemon-not-stopped
+
exit 0
-# vim:set ai et sts=2 sw=2 tw=0:
+# vim:set ai et sts=2 sw=2 tw=80:
Modified: trunk/debian/xdm.postrm.in
===================================================================
--- trunk/debian/xdm.postrm.in 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/xdm.postrm.in 2004-04-15 20:33:10 UTC (rev 1261)
@@ -1,6 +1,6 @@
#!/bin/sh
# Debian xdm package post-removal script
-# Copyright 1998--2000, 2003 Branden Robinson.
+# Copyright 1998--2000, 2003, 2004 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.
@@ -14,9 +14,9 @@
#INCLUDE_SHELL_LIB#
-if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ]; then
- if [ -d /usr/X11R6/lib/X11/xdm.moved-by-preinst -a \
- -L /usr/X11R6/lib/X11/xdm ]; then
+if [ "$1" = "abort-install" ] || [ "$1" = "abort-upgrade" ]; then
+ if [ -d /usr/X11R6/lib/X11/xdm.moved-by-preinst ] \
+ && [ -L /usr/X11R6/lib/X11/xdm ]; then
rm /usr/X11R6/lib/X11/xdm
mv /usr/X11R6/lib/X11/xdm.moved-by-preinst /usr/X11R6/lib/X11/xdm
fi
@@ -36,7 +36,7 @@
#DEBHELPER#
if [ "$1" = "purge" ]; then
- update-rc.d "$THIS_PACKAGE" remove
+ update-rc.d xdm remove
for DIR in /etc/X11/xdm /var/lib/xdm; do
if [ -d "$DIR" ]; then
rm -r "$DIR"
@@ -44,6 +44,67 @@
done
fi
+if [ "$1" = "abort-upgrade" ]; then
+ # NOTE: The following is copied from the postinst script and isn't necessary
+ # if dpkg executes a package's postinst script with the "configure" argument
+ # after unwinding from a failed upgrade. (See section 6.5 of the Debian
+ # Policy Manual, "Details of unpack phase of installation or upgrade".)
+
+ # We are here because an upgrade is being aborted; check the options file to
+ # see if the user wants the daemon (re-)started.
+ NOSTART=
+ XDM_WHERE=
+ # Don't start the daemon if it wasn't stopped...
+ if [ -e /var/run/xdm.daemon-not-stopped ]; then
+ NOSTART=yes
+ fi
+ # ...or if the options file says not to.
+ if ! grep -qs ^restart-on-upgrade /etc/X11/xdm/xdm.options; then
+ NOSTART=yes
+ fi
+
+ # At this point we may think we *should* be starting the daemon, but we need to
+ # do some more checks.
+
+ DENYSTART=
+ # Also don't start the daemon if it's already running...
+ if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/xdm.pid \
+ --exec /usr/bin/X11/xdm; then
+ # Note our refusal to start the daemon if we were supposed to start it.
+ [ -n "$NOSTART" ] || DENYSTART=yes
+ XDM_WHERE="pid $(cat /var/run/xdm.pid)"
+ else
+ # ...or if we're currently in X on any of the displays it attempts to manage
+ # by default.
+ if [ -s /etc/X11/xdm/Xservers ]; then
+ MANAGED_DISPLAYS="$(egrep -v '^[[:space:]]*#' /etc/X11/xdm/Xservers \
+ | sed 's/[[:space:]].*//')"
+ if [ -n "$MANAGED_DISPLAYS" ]; then
+ for MANAGED_DISPLAY in $MANAGED_DISPLAYS; do
+ if echo "$DISPLAY" | grep -q "^$MANAGED_DISPLAY"; then
+ # Note our refusal to start the daemon if we were supposed to start
+ # it.
+ [ -n "$NOSTART" ] || DENYSTART=yes
+ XDM_WHERE="$DISPLAY, which xdm will attempt to manage"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+
+ # If the user wanted us to start the daemon but we refuse, explain why.
+ if [ -n "$DENYSTART" ]; then
+ warn "not starting xdm because it is already running at $XDM_WHERE"
+ NOSTART=yes
+ fi
+
+ [ -n "$NOSTART" ] || invoke-rc.d xdm start || true
+
+ # Remove flag files.
+ rm -f /var/run/xdm.install /var/run/xdm.daemon-not-stopped
+fi
+
exit 0
-# vim:set ai et sts=2 sw=2 tw=0:
+# vim:set ai et sts=2 sw=2 tw=80:
Modified: trunk/debian/xdm.preinst.in
===================================================================
--- trunk/debian/xdm.preinst.in 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/xdm.preinst.in 2004-04-15 20:33:10 UTC (rev 1261)
@@ -1,6 +1,6 @@
#!/bin/sh
# Debian xdm package pre-installation script
-# Copyright 1998--2001, 2003 Branden Robinson.
+# Copyright 1998--2001, 2003, 2004 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.
@@ -14,7 +14,7 @@
#INCLUDE_SHELL_LIB#
-if [ "$1" = "install" -o "$1" = "upgrade" ]; then
+if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
# deal with a bug in very old versions of xbase (prior to 3.3.2-1)
if dpkg --compare-versions "$2" lt "3.3.2-1"; then
for DIR in rc0.d rc1.d rc6.d; do
@@ -29,7 +29,7 @@
# symbolic link to the /etc/X11/xdm directory; move an existing directory out
# of the way (even if we're installing over a non-packaged XFree86
# installation)
- if [ -e /usr/X11R6/lib/X11/xdm -a ! -L /usr/X11R6/lib/X11/xdm ]; then
+ if [ -e /usr/X11R6/lib/X11/xdm ] && [ ! -L /usr/X11R6/lib/X11/xdm ]; then
observe "removing obsolete /usr/X11R6/lib/X11/xdm directory"
mv /usr/X11R6/lib/X11/xdm /usr/X11R6/lib/X11/xdm.moved-by-preinst
fi
@@ -54,8 +54,14 @@
check_symlinks_and_warn /usr/X11R6/lib/X11/xdm
fi
+if [ "$1" = "install" ]; then
+ # Create a flag file that tells the postinst script this is an install, not
+ # an upgrade.
+ : >/var/run/xdm.install
+fi
+
#DEBHELPER#
exit 0
-# vim:set ai et sts=2 sw=2 tw=0:
+# vim:set ai et sts=2 sw=2 tw=80:
Modified: trunk/debian/xdm.prerm.in
===================================================================
--- trunk/debian/xdm.prerm.in 2004-04-15 20:13:01 UTC (rev 1260)
+++ trunk/debian/xdm.prerm.in 2004-04-15 20:33:10 UTC (rev 1261)
@@ -1,6 +1,6 @@
#!/bin/sh
# Debian xdm package pre-removal script
-# Copyright 1998--2003 Branden Robinson.
+# Copyright 1998--2004 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.
@@ -76,16 +76,18 @@
fi
if [ -n "$STOP" ]; then
- invoke-rc.d "$THIS_PACKAGE" stop || true
+ invoke-rc.d xdm stop || true
else
- if [ "$1" = "upgrade" -o "$1" = "failed-upgrade" ]; then
- touch /var/run/xdm.upgrade
+ if [ "$1" = "upgrade" ] || [ "$1" = "failed-upgrade" ]; then
+ # Create a flag file that tells the postinst and postrm scripts that the
+ # daemon was not stopped.
+ : >/var/run/xdm.daemon-not-stopped
fi
fi
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
-if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
+if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
if [ -n "$HAVE_DEBCONF" ]; then
# disown this question
run db_unregister shared/default-x-display-manager
@@ -158,4 +160,4 @@
exit 0
-# vim:set ai et sts=2 sw=2 tw=0:
+# vim:set ai et sts=2 sw=2 tw=80:
Reply to: