[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force X.Org X11 SVN commit: r153 - trunk/debian



Author: dnusinow
Date: 2005-06-08 18:50:35 -0500 (Wed, 08 Jun 2005)
New Revision: 153

Added:
   trunk/debian/xdm.README.Debian
   trunk/debian/xdm.config.in
   trunk/debian/xdm.dirs
   trunk/debian/xdm.init
   trunk/debian/xdm.install
   trunk/debian/xdm.links
   trunk/debian/xdm.logrotate
   trunk/debian/xdm.pam
   trunk/debian/xdm.postinst.in
   trunk/debian/xdm.postrm.in
   trunk/debian/xdm.preinst.in
   trunk/debian/xdm.prerm.in
   trunk/debian/xdm.templates
Modified:
   trunk/debian/changelog
Log:
Add packaging files for xdm. Audited, altered, and approved by David.

- Merging xdm.init script changes from Ubuntu in to xfree86 trunk script
- Re-adding Xreset to xdm.install
- Using the xfree86 trunk xdm.logrotate and xdm.README.Debian


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/changelog	2005-06-08 23:50:35 UTC (rev 153)
@@ -21,7 +21,7 @@
       - Merge changes from xfree tree to scripts directory:
         - manifest-install-reconcile
         - validate-posix-sh
-      - Merge changes from xfree tree to local directory:
+      - Merge changes from xfree86 tree to local directory:
         - dexconf
         - dexconf.1
         - FAQ.xhtml
@@ -30,11 +30,14 @@
         - xvfb-run
         - xdm/Xstartup
         - Xsession.d/30xorg-common_xresources
+        - xdm.init
+        - xdm.logrotate
+        - xdm.README.Debian
 
     - Re-add jisx0208.1983-0.enc.gz to MANIFEST.all's list of font encodings
       until I know more about why it was removed.
 
-    - Re-add the following to MANIFEST.[arch] 
+    - Re-add the following to MANIFEST.[arch] and xdm.install
       - etc/X11/xdm/Xreset
 
     - Re-enable various modules for xlibmesa-dri-dbg.install

Added: trunk/debian/xdm.README.Debian
===================================================================
--- trunk/debian/xdm.README.Debian	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.README.Debian	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,61 @@
+Debian README for xdm package
+=============================
+
+Newcomers to the X Window System should first read the file
+/usr/share/doc/xfree86-common/FAQ.gz.  You can view this file with your
+favorite pager program after decompressing it.  For example:
+    $ zcat /usr/share/doc/xfree86-common/FAQ.gz | pager
+
+Upgraders from Debian GNU/Linux 2.0 or earlier should be aware that the
+/etc/X11/config file is no longer used; its xdm-specific options are now in
+/etc/X11/xdm/xdm.options.
+
+The default configuration for the X display manager (xdm) under Debian
+GNU/Linux presumes that one wishes xdm to manage one local session.  (In
+other words, the xdm login screen occupies one virtual console
+automatically at boot.)  If one does not wish to run a local X server, the
+following line should be commented out of /etc/X11/xdm/Xservers:
+
+:0 local /usr/bin/X11/X vt7 -deferglyphs 16
+
+Several configuration files are shipped with the xdm package; they reside
+in the /etc/X11/xdm/ directory.  Extensive documentation about the xdm
+configuration files may be found in the xdm(1) manual page.
+
+xdm-config contains X resources specific to xdm itself.  See the X(1)
+manual page for more information about X resources, and the xdm(1) manual
+pages for documentation of the available xdm resources.
+
+Xresources contains X resources that are designed to be specfic to sessions
+running under xdm.  Note that this file does contain the resource entries
+for xdm itself -- those are contained in the file xdm-config.  See the X(1)
+manual page for more information about X resources.
+
+The above three files, despite being X resource files, are not placed in the
+/etc/X11/Xresources directory (see /usr/share/doc/xbase/README.Debian) because
+they should not be used automatically in all X sessions; the /etc/X11/Xsession
+script merges in the resources of all files found in /etc/X11/Xresources, and
+this action would be inappropriate for these resource files.
+
+Xservers contains entries to start the X server(s) on the local machine, and
+on any remote X terminals that do not support XDMCP.  This file is internally
+documented.
+
+Xaccess determines what hosts on the network may use the services of the
+running xdm daemon.  This file is internally documented.  Note that as of
+version 3.3.4-1 of the xdm package, all remote XDMCP access is turned off
+by default.
+
+Xstartup is a shell script which is run (as root) after a user has logged in
+on a server.
+
+Xreset is a shell script which is run (as root) after a user's X session ends on
+a server.
+
+xdm.options contains configuration options for xdm that are specific to the
+Debian GNU/Linux system.  See the xdm.options(5) manual page for more
+information.
+
+$Id: xdm.README.Debian 1966 2004-10-18 18:03:43Z branden $
+
+vim:set ai et sts=4 sw=4 tw=80:

Added: trunk/debian/xdm.config.in
===================================================================
--- trunk/debian/xdm.config.in	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.config.in	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,82 @@
+#!/bin/sh
+# Debian xdm package configuration script
+# Copyright 2000--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>.
+
+# $Id: xdm.config.in 1255 2004-04-14 19:18:02Z branden $
+
+set -e
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+THIS_PACKAGE=xdm
+THIS_SCRIPT=config
+
+#INCLUDE_SHELL_LIB#
+
+# set default display manager
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+
+OWNERS=
+if db_metaget shared/default-x-display-manager owners; then
+  OWNERS="$RET"
+fi
+
+CHOICES=
+if db_metaget shared/default-x-display-manager choices; then
+  CHOICES="$RET"
+fi
+
+if [ "$OWNERS" != "$CHOICES" ]; then
+  observe "X display managers now available are \"$OWNERS\""
+  run db_subst shared/default-x-display-manager choices "$OWNERS"
+  run db_fset shared/default-x-display-manager seen false
+fi
+
+# debconf is not a registry; use the current contents of the default display
+# manager file to pre-answer the question if possible
+if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+  CURRENT_DEFAULT=$(basename "$(grep -v '^[[:space:]]*#' \
+                                "$DEFAULT_DISPLAY_MANAGER_FILE" |
+                                head -n 1)")
+  if [ -n "$CURRENT_DEFAULT" ]; then
+    if ! which "$CURRENT_DEFAULT" >/dev/null 2>&1; then
+      observe "default display manager \"$CURRENT_DEFAULT\" specified in" \
+              "$DEFAULT_DISPLAY_MANAGER_FILE does not exist or is not" \
+              "executable"
+    fi
+    run db_set shared/default-x-display-manager "$CURRENT_DEFAULT"
+  fi
+else
+  CURRENT_DEFAULT=
+  if db_get shared/default-x-display-manager; then
+    CURRENT_DEFAULT="$RET"
+  fi
+fi
+
+run db_input high shared/default-x-display-manager
+run db_go
+
+# using this display manager?
+NEW_DEFAULT=
+if db_get shared/default-x-display-manager; then
+  NEW_DEFAULT="$RET"
+fi
+
+# move the default display manager file if we're going to change it
+if [ -n "$NEW_DEFAULT" ]; then
+  if [ "$NEW_DEFAULT" != "$CURRENT_DEFAULT" ]; then
+    if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+      observe "preparing to change default X display manager from" \
+              "\"$CURRENT_DEFAULT\" to \"$NEW_DEFAULT\""
+      mv "$DEFAULT_DISPLAY_MANAGER_FILE" \
+         "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
+    fi
+  fi
+fi
+
+exit 0
+
+# vim:set ai et sts=2 sw=2 tw=80:

Added: trunk/debian/xdm.dirs
===================================================================
--- trunk/debian/xdm.dirs	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.dirs	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1 @@
+var/lib/xdm

Added: trunk/debian/xdm.init
===================================================================
--- trunk/debian/xdm.init	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.init	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,146 @@
+#!/bin/sh
+
+# $Id: xdm.init 2143 2005-01-21 18:08:32Z branden $
+
+# Copyright 1998-2002, 2004, 2005 Branden Robinson <branden@debian.org>.
+#
+# This is free software; you may redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# This is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License with
+# 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
+
+set -e
+
+# To start xdm even if it is not the default display manager, change
+# HEED_DEFAULT_DISPLAY_MANAGER to "false."
+HEED_DEFAULT_DISPLAY_MANAGER=true
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DAEMON=/usr/bin/X11/xdm
+PIDFILE=/var/run/xdm.pid
+UPGRADEFILE=/var/run/xdm.daemon-not-stopped
+
+test -x $DAEMON || exit 0
+
+stillrunning () {
+  if expr "$(cat /proc/$DAEMONPID/cmdline 2>/dev/null)" : "$DAEMON" >/dev/null \
+    2>&1; then
+    true
+  else
+    # if the daemon does not remove its own pidfile, we will
+    rm -f $PIDFILE $UPGRADEFILE
+    false
+  fi
+}
+
+# If we have upgraded the daemon since we last started it, we can't use the
+# --exec argument to start-stop-daemon, because the daemon's inode will have
+# changed.  The risk here is that in a situation where the daemon died, its
+# pidfile was not cleaned up, we've upgraded it, *and* some other process is now
+# running under that pid, start-stop-daemon will send signals to an innocent
+# process.  However, this seems like a corner case.  C'est la vie!
+if [ -e $UPGRADEFILE ]; then
+  SSD_START_ARGS="--pidfile $PIDFILE --startas $DAEMON"
+  SSD_STOP_ARGS="--pidfile $PIDFILE --name ${DAEMON#**/}"
+else
+  SSD_START_ARGS="--pidfile $PIDFILE --exec $DAEMON"
+  SSD_STOP_ARGS="$SSD_START_ARGS"
+fi
+
+case "$1" in
+  start)
+    if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
+       [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
+       [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
+      echo "Not starting X display manager (xdm); it is not the default" \
+        "display manager."
+    else
+      echo -n "Starting X display manager: xdm"
+      start-stop-daemon --start --quiet $SSD_START_ARGS \
+        || echo -n " already running"
+      echo "."
+    fi
+  ;;
+
+  restart)
+    /etc/init.d/xdm stop
+    if [ -f $PIDFILE ]; then
+      if stillrunning; then
+        exit 1
+      fi
+    fi
+    /etc/init.d/xdm start
+  ;;
+
+  reload)
+    echo -n "Reloading X display manager configuration..."
+    if start-stop-daemon --stop --signal 1 --quiet $SSD_STOP_ARGS; then
+      echo "done."
+    else
+      echo "xdm not running."
+    fi
+  ;;
+
+  force-reload)
+    /etc/init.d/xdm reload
+  ;;
+
+  stop)
+    echo -n "Stopping X display manager: xdm"
+    if ! [ -f $PIDFILE ]; then
+      echo " not running ($PIDFILE not found)"
+      # The daemon is not running; do not tell the maintainer scripts that it
+      # has not stopped.
+      rm -f $UPGRADEFILE
+	  exit 0
+    else
+      DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
+      KILLCOUNT=1
+      if ! [ -e $UPGRADEFILE ]; then
+        if start-stop-daemon --stop --quiet $SSD_STOP_ARGS; then
+          # give xdm's signal handler a second to catch its breath
+          sleep 1
+        else
+          echo -n " not running"
+        fi
+      fi
+      while [ $KILLCOUNT -le 5 ]; do
+        if stillrunning; then
+          kill $DAEMONPID
+        else
+          break
+        fi
+        sleep 1
+        KILLCOUNT=$(( $KILLCOUNT + 1 ))
+      done
+      if stillrunning; then
+        echo -n " not responding to TERM signal (pid $DAEMONPID)"
+      else
+        # The daemon is not running; do not tell the maintainer scripts that it
+        # has not stopped.
+        rm -f $UPGRADEFILE
+      fi
+    fi
+    echo "."
+  ;;
+
+  *)
+    echo "Usage: /etc/init.d/xdm {start|stop|restart|reload|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# vim:set ai et sts=2 sw=2 tw=80:

Added: trunk/debian/xdm.install
===================================================================
--- trunk/debian/xdm.install	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.install	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,18 @@
+etc/X11/app-defaults/Chooser
+etc/X11/xdm/Xaccess
+etc/X11/xdm/Xreset
+etc/X11/xdm/Xresources
+etc/X11/xdm/Xservers
+etc/X11/xdm/Xsession
+etc/X11/xdm/Xstartup
+etc/X11/xdm/Xwilling
+etc/X11/xdm/pixmaps/debian.xpm
+etc/X11/xdm/pixmaps/debianbw.xpm
+etc/X11/xdm/pixmaps/xorg-bw.xpm
+etc/X11/xdm/pixmaps/xorg.xpm
+etc/X11/xdm/xdm-config
+etc/X11/xdm/xdm.options
+usr/X11R6/bin/chooser
+usr/X11R6/bin/xdm
+usr/X11R6/man/man1/xdm.1x
+usr/share/man/man5/xdm.options.5

Added: trunk/debian/xdm.links
===================================================================
--- trunk/debian/xdm.links	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.links	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1 @@
+etc/X11/xdm usr/X11R6/lib/X11/xdm

Added: trunk/debian/xdm.logrotate
===================================================================
--- trunk/debian/xdm.logrotate	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.logrotate	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,17 @@
+# $Id: xdm.logrotate 2240 2005-04-10 19:12:41Z branden $
+
+/var/log/xdm.log {
+    weekly
+    rotate 52
+    compress
+    delaycompress
+    notifempty
+    missingok
+    postrotate
+        if [ -r /var/run/xdm.pid ]; then \
+            kill -s USR2 $(cat /var/run/xdm.pid); \
+        fi
+    endscript
+}
+
+# vim:set ai et sts=4 sw=4 tw=80:

Added: trunk/debian/xdm.pam
===================================================================
--- trunk/debian/xdm.pam	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.pam	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,10 @@
+# $Id: xdm.pam 1266 2004-04-17 02:33:33Z branden $
+
+@include common-auth
+@include common-account
+@include common-session
+@include common-password
+
+auth		requisite	pam_nologin.so
+auth		required	pam_env.so
+session		required	pam_limits.so

Added: trunk/debian/xdm.postinst.in
===================================================================
--- trunk/debian/xdm.postinst.in	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.postinst.in	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,153 @@
+#!/bin/sh
+# Debian xdm package post-installation script
+# 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>.
+# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.
+
+# $Id: xdm.postinst.in 1594 2004-07-07 12:46:10Z branden $
+
+set -e
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+THIS_PACKAGE=xdm
+THIS_SCRIPT=postinst
+
+#INCLUDE_SHELL_LIB#
+
+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 ] \
+  && [ -L /usr/X11R6/lib/X11/xdm ]; then
+  rm -r /usr/X11R6/lib/X11/xdm.moved-by-preinst
+fi
+
+# now safe to remove obsolete conffiles
+for F in /etc/X11/xdm/Xreset /etc/X11/xdm/Xsetup /etc/X11/xdm/pixmaps/XFree86.xpm /etc/X11/xdm/pixmaps/XFree86bw.xpm; do
+  remove_conffile_commit "$F"
+done
+
+# debconf is not a registry, so we only fiddle with the default file if it
+# does not exist
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+if ! [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+  DEFAULT_DISPLAY_MANAGER=
+  if db_get shared/default-x-display-manager; then
+    DEFAULT_DISPLAY_MANAGER="$RET"
+  fi
+  if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
+    DAEMON_NAME=
+    if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
+      DAEMON_NAME="$RET"
+    fi
+    if [ -z "$DAEMON_NAME" ]; then
+      # if we were unable to determine the name of the selected daemon (for
+      # instance, if the selected default display manager doesn't provide a
+      # daemon_name question), guess
+      DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
+      if [ -z "$DAEMON_NAME" ]; then
+        warn "unable to determine path to default X display manager" \
+             "$DEFAULT_DISPLAY_MANAGER; not updating" \
+             "$DEFAULT_DISPLAY_MANAGER_FILE"
+      fi
+    fi
+    if [ -n "$DAEMON_NAME" ]; then
+      observe "committing change of default X display manager"
+      echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
+    fi
+  fi
+fi
+
+# remove the displaced old default display manager file if it exists
+if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
+  rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
+fi
+
+# Registering the init scripts or starting the daemon may cause output to
+# stdout, which can confuse debconf.
+db_stop
+
+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_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
+  fi
+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
+  # Note our refusal to start the daemon if we were supposed to start it.
+  [ -n "$NOSTART" ] || DENYSTART=yes
+  DENIAL_REASON="xdm is already running at pid $(cat /var/run/xdm.pid)"
+  if [ -d /var/state/xdm ]; then
+    warn "obsolete directory /var/state/xdm cannot be removed because" \
+         "$DENIAL_REASON; 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
+          DENIAL_REASON="an X server is already running at $DISPLAY, which"
+          DENIAL_REASON="$DENIAL_REASON xdm is configured to 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 $DENIAL_REASON"
+  NOSTART=yes
+fi
+
+[ -n "$NOSTART" ] || invoke-rc.d xdm start || true
+
+#DEBHELPER#
+
+# Remove install flag file.  Leave the "daemon not stopped" flag file, if it
+# exists, so that it will be seen by the init script.
+rm -f /var/run/xdm.install
+
+exit 0
+
+# vim:set ai et sts=2 sw=2 tw=80:

Added: trunk/debian/xdm.postrm.in
===================================================================
--- trunk/debian/xdm.postrm.in	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.postrm.in	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,110 @@
+#!/bin/sh
+# Debian xdm package post-removal script
+# 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>.
+# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.
+
+# $Id: xdm.postrm.in 1261 2004-04-15 20:33:10Z branden $
+
+set -e
+
+THIS_PACKAGE=xdm
+THIS_SCRIPT=postrm
+
+#INCLUDE_SHELL_LIB#
+
+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
+
+  # roll back removal of obsolete conffiles
+  for F in /etc/X11/xdm/Xreset /etc/X11/xdm/Xsetup /etc/X11/xdm/pixmaps/XFree86.xpm /etc/X11/xdm/pixmaps/XFree86bw.xpm; do
+    remove_conffile_rollback "$F"
+  done
+
+  # roll back displacement of default display manager file
+  if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
+    observe "rolling back change of default X display manager"
+    mv "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" "$DEFAULT_DISPLAY_MANAGER_FILE"
+  fi
+fi
+
+#DEBHELPER#
+
+if [ "$1" = "purge" ]; then
+  update-rc.d xdm remove
+  for DIR in /etc/X11/xdm /var/lib/xdm; do
+    if [ -d "$DIR" ]; then
+      rm -r "$DIR"
+    fi
+  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=80:

Added: trunk/debian/xdm.preinst.in
===================================================================
--- trunk/debian/xdm.preinst.in	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.preinst.in	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Debian xdm package pre-installation script
+# 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>.
+# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.
+
+# $Id: xdm.preinst.in 1261 2004-04-15 20:33:10Z branden $
+
+set -e
+
+THIS_PACKAGE=xdm
+THIS_SCRIPT=preinst
+
+#INCLUDE_SHELL_LIB#
+
+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
+      if [ -L "/etc/$DIR/K1xdm" ]; then
+        observe "fixing buggy symbolic link /etc/$DIR/K1xdm"
+        mv "/etc/$DIR/K1xdm" "/etc/$DIR/K01xdm"
+      fi
+    done
+  fi
+
+  # as of the xfree86 4.x packages, we expect /usr/X11R6/lib/X11/xdm to be a
+  # 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 ] && ! [ -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
+
+  # got rid of the shared libXdmGreet in 4.0.3
+  if dpkg --compare-versions "$2" lt "4.0.3-1"; then
+    if update-alternatives --display xdm-greeter |
+       fgrep -q /usr/X11R6/lib/libXdmGreet.so.1; then
+      observe "removing obsolete xdm-greeter alternative and .so symlink"
+      update-alternatives --remove xdm-greeter /usr/X11R6/lib/libXdmGreet.so.1
+      # remove this garbage link that ldconfig creates
+      rm -f /usr/X11R6/lib/libXdmGreet.so
+    fi
+  fi
+
+  # default Xreset and Xsetup conffiles went away in 4.2.1-12
+  if dpkg --compare-versions "$2" lt "4.2.1-12"; then
+    remove_conffile_prepare /etc/X11/xdm/Xreset d65cd850f647f7f3d6a076273a3bbb1f
+    remove_conffile_prepare /etc/X11/xdm/Xsetup 9e68b23946b72af86f88593394ba9339
+  fi
+
+  if dpkg --compare-versions "$2" lt "6.8.1-0.3"; then
+    remove_conffile_prepare /etc/X11/xdm/pixmaps/XFree86.xpm 91cf8f46b31119b5d69270ae7bc5081d
+    remove_conffile_prepare /etc/X11/xdm/pixmaps/XFree86bw.xpm c9ef591e6e78edd3d2352e55c0067160
+  fi
+
+  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=80:

Added: trunk/debian/xdm.prerm.in
===================================================================
--- trunk/debian/xdm.prerm.in	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.prerm.in	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,163 @@
+#!/bin/sh
+# Debian xdm package pre-removal script
+# 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>.
+# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.
+
+# $Id: xdm.prerm.in 1261 2004-04-15 20:33:10Z branden $
+
+set -e
+
+# debconf may not be available if some massive purging is going on
+HAVE_DEBCONF=
+if [ -e /usr/share/debconf/confmodule ]; then
+  . /usr/share/debconf/confmodule
+  HAVE_DEBCONF=yes
+fi
+
+THIS_PACKAGE=xdm
+THIS_SCRIPT=prerm
+
+#INCLUDE_SHELL_LIB#
+
+case "$1" in
+  # we NEVER want to unconditionally stop xdm; see below
+  upgrade|failed-upgrade)
+    REMOVING=
+    ;;
+  remove|deconfigure)
+    REMOVING=yes
+    ;;
+esac
+
+STOP=
+# are we supposed to restart on upgrade?  if REMOVING xdm, we don't care what
+# the user says, we have to stop the daemon
+if grep -qs ^restart-on-upgrade /etc/X11/xdm/xdm.options ||
+   [ -n "$REMOVING" ]; then
+  # is there an xdm process running?
+  if start-stop-daemon --stop --quiet --signal 0 --exec /usr/bin/X11/xdm; then
+    # any children?
+    PARENTS=$(pidof /usr/bin/X11/xdm || true)
+    CHILDREN=
+    if [ -n "$PARENTS" ]; then
+      for PROCESS in $PARENTS; do
+        # make sure we got numbers back
+        [ $PROCESS -eq $PROCESS ] 2> /dev/null ||
+          die "pidof returned non-numeric value"
+        # we could use grep -q here if ps would ignore SIGPIPE :-P
+        if (ps axj | grep "^ *$PROCESS" > /dev/null 2>&1); then
+          CHILDREN=yes
+        fi
+      done
+      if [ -n "$CHILDREN" ]; then
+        if [ -n "$HAVE_DEBCONF" ]; then
+          # ask the question
+          run db_input high xdm/stop_running_server_with_children
+          run db_go
+          # what did the user say?
+          ANSWER=
+          if db_get xdm/stop_running_server_with_children; then
+            ANSWER="$RET"
+          fi
+          if [ "$ANSWER" = "true" ]; then
+            STOP=yes
+          fi
+          # forget that we have seen the question; this is the sort of
+          # non-configuration question that should be asked every time
+          run db_fset xdm/stop_running_server_with_children seen false
+        fi
+      else
+        STOP=yes
+      fi
+    fi
+  fi
+fi
+
+if [ -n "$STOP" ]; then
+  invoke-rc.d xdm stop || true
+else
+  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" ] || [ "$1" = "deconfigure" ]; then
+  if [ -n "$HAVE_DEBCONF" ]; then
+    # disown this question
+    run db_unregister shared/default-x-display-manager
+    # does the question still exist?
+    if db_get shared/default-x-display-manager; then
+      if db_metaget shared/default-x-display-manager owners; then
+        observe "X display managers now available are \"$OWNERS\""
+        run db_subst shared/default-x-display-manager choices "$RET"
+      fi
+      DEFAULT_DISPLAY_MANAGER=
+      if db_get shared/default-x-display-manager; then
+        DEFAULT_DISPLAY_MANAGER="$RET"
+      fi
+      # are we removing the currently selected display manager?
+      if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
+        if [ "$THIS_PACKAGE" = "$DEFAULT_DISPLAY_MANAGER" ]; then
+          if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+            if db_get "$DEFAULT_DISPLAY_MANAGER/daemon_name"; then
+              # does the display manager file reference the current default?  if
+              # so, remove it because it will now be wrong
+              if [ -n "$RET" ]; then
+                if [ "$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")" = "$RET" ]; then
+                  rm "$DEFAULT_DISPLAY_MANAGER_FILE"
+                fi
+              fi
+            fi
+          fi
+          # ask the user to choose a new default
+          run db_fset shared/default-x-display-manager seen false
+          run db_input critical shared/default-x-display-manager
+          run db_go
+          # if the default display manager file doesn't exist, write it with
+          # the path to the new default display manager
+          if ! [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+            DEFAULT_DISPLAY_MANAGER=
+            if db_get shared/default-x-display-manager; then
+              DEFAULT_DISPLAY_MANAGER="$RET"
+            fi
+            if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
+              warn "new default display manager has been selected; please be" \
+                   "sure to run \"dpkg-reconfigure $RET\" to ensure that it" \
+                   "is configured"
+              DAEMON_NAME=
+              if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
+                DAEMON_NAME="$RET"
+              fi
+              if [ -z "$DAEMON_NAME" ]; then
+                # If we were unable to determine the name of the selected daemon
+                # (for instance, if the selected default display manager doesn't
+                # provide a daemon_name question), guess.
+                DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
+                if [ -z "$DAEMON_NAME" ]; then
+                  warn "unable to determine path to default X display manager" \
+                       "$DEFAULT_DISPLAY_MANAGER; not updating" \
+                       "$DEFAULT_DISPLAY_MANAGER_FILE"
+                fi
+              fi
+              if [ -n "$DAEMON_NAME" ]; then
+                echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+#DEBHELPER#
+
+exit 0
+
+# vim:set ai et sts=2 sw=2 tw=80:

Added: trunk/debian/xdm.templates
===================================================================
--- trunk/debian/xdm.templates	2005-06-08 23:03:25 UTC (rev 152)
+++ trunk/debian/xdm.templates	2005-06-08 23:50:35 UTC (rev 153)
@@ -0,0 +1,31 @@
+Template: shared/default-x-display-manager
+Type: select
+Choices: ${choices}
+_Description: Select the desired default display manager.
+ A display manager is a program that provides graphical login capabilities for
+ the X Window System.
+ .
+ Only one display manager can manage a given X server, but multiple display
+ manager packages are installed.  Please select which display manager should
+ run by default.
+ .
+ (Multiple display managers can run simultaneously if they are configured to
+ manage different servers; to achieve this, configure the display managers
+ accordingly, edit each of their init scripts in /etc/init.d, and disable the
+ check for a default display manager.)
+
+Template: xdm/daemon_name
+Type: string
+Default: /usr/bin/X11/xdm
+Description: internal use only
+ This template is never shown to the user and does not require translation.
+
+Template: xdm/stop_running_server_with_children
+Type: boolean
+Default: false
+_Description: Do you wish to stop the xdm daemon?
+ The X display manager (xdm) daemon is typically stopped on package upgrade
+ and removal, but it appears to be managing at least one running X session.
+ If xdm is stopped now, any X sessions it manages will be terminated.
+ Otherwise you may leave xdm running, and the new version will take effect the
+ next time the daemon is restarted.



Reply to: