Subject: xfree86-common: Should include /etc/X11/Xreset{.d}

From: Petter Reinholdtsen <[email-masked]>
Date: Fri, 30 Jan 2004 23:23:50 +0100

Package:  xfree86-common
Version:  4.2.1-16
Severity: wishlist

In skolelinux, we would like to run a script when the users are
logging out, to do general cleanup.  For this, it would be useful if
the display managers had hooks in Xreset we could use to have our
script executed.

Could you please add /etc/X11/Xreset and /etc/X11/Xreset.d (like the
current /etc/X11/Xsession{.d}), and thus make it possible for the
display managers to share one such file?

If you are interested in adding this feature, I'll provide a patch and
send bugreports against wdm, xdm and kdm to ask them to use this file.

(Not sure why gdm do not include a Xreset file, but it did not appear
on
<URL:http://packages.debian.org/cgi-bin/search_contents.pl?word=Xreset>).
I'll file a bug on gdm too just to keep all of them consistent. :)

---

From: Marc Wilson <[email-masked]>
Date: Sat, 31 Jan 2004 21:15:40 -0800

> send bugreports against wdm, xdm and kdm to ask them to use this file.

What patch would you be adding against xdm, exactly, since xdm already
knows how to do this quite well on its own?

Well, it doesn't do anything silly like /etc/X11/Xreset.d, but it does
support Xreset and has pretty much forever.  The fact that Debian doesn't
ship one just means that you get to create one.

See xdm(1).

-- 
 Marc Wilson |     For the next hour, WE will control all that you see
 [email-masked] |     and hear.

---

From: Petter Reinholdtsen <[email-masked]>
Date: 15 Feb 2004 01:21:02 +0100

[Marc Wilson]
> knows how to do this quite well on its own?

Something like inserting a file with something like this:

  #!/bin/sh
  # Do xdm specific stuff here
  # invoke global X reset script
  . /etc/X11/Xreset
  # Do more xdm specific stuff here

The file /etc/X11/Xreset could then include something like this
(copied from Xsession):

  #!/bin/sh
  message () {
    # pretty-print messages of arbitrary length; use xmessage if it
    # is available and $DISPLAY is set
    MESSAGE="$PROGNAME: $*"
    echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
    if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
      echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
    fi
  }
  errormsg () {
    # exit script with error
    message "$*"
    exit 1
  }
  internal_errormsg () {
    # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
    # One big call to message() for the sake of xmessage; if we had two then
    # the user would have dismissed the error we want reported before seeing the
    # request to report it.
    errormsg "$*" \
             "Please report the installed version of the \"xfree86-common\"" \
             "package and the complete text of this error message to" \
             "<[email-masked]>."
  }
  run_parts () {
    # until run-parts --noexec is implemented
    if [ -z "$1" ]; then
      internal_errormsg "run_parts() called without an argument."
    fi
    if [ ! -d "$1" ]; then
      internal_errormsg "run_parts() called, but \"$1\" does not exist or is" \
                        "not a directory."
    fi
    for F in $(ls $1); do
      if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
        if [ -f "$1/$F" ]; then
          echo "$1/$F"
        fi
      fi
    done
  }
  SYSSESSIONDIR=/etc/X11/Xreset.d
  SESSIONFILES=$(run_parts $SYSSESSIONDIR)
  if [ -n "$SESSIONFILES" ]; then
    for SESSIONFILE in $SESSIONFILES; do
      . $SESSIONFILE
    done
  fi
  exit 0

If all ?dm implementations in Debian supported this, it would be easy
for the Debian-Edu / Skolelinux to hook into the configuration.  Of
course, we could add separate hooks for each ?dm package and try to
keep them in sync, but the task is so similar that I believe it is
best to store it in one file shared by all display managers.

> See xdm(1).

I've read it. :)