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

Bug#230422: xfree86-common: Should include /etc/X11/Xreset{.d}



[Marc Wilson]
> What patch would you be adding against xdm, exactly, since xdm already
> 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" \
             "<debian-x@lists.debian.org>."
  }
  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. :)




Reply to: