<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.cs.earlham.edu/index.php?action=history&amp;feed=atom&amp;title=%2Fetc%2FX11%2FXsession</id>
	<title>/etc/X11/Xsession - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cs.earlham.edu/index.php?action=history&amp;feed=atom&amp;title=%2Fetc%2FX11%2FXsession"/>
	<link rel="alternate" type="text/html" href="https://wiki.cs.earlham.edu/index.php?title=/etc/X11/Xsession&amp;action=history"/>
	<updated>2026-07-23T20:06:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.cs.earlham.edu/index.php?title=/etc/X11/Xsession&amp;diff=11161&amp;oldid=prev</id>
		<title>Jbkorth07: New page: #!/bin/sh # # /etc/X11/Xsession # # global Xsession file -- used by display managers and xinit (startx)  # $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $  set -e  PROGNAME=Xsession  mes...</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.earlham.edu/index.php?title=/etc/X11/Xsession&amp;diff=11161&amp;oldid=prev"/>
		<updated>2010-04-16T17:05:30Z</updated>

		<summary type="html">&lt;p&gt;New page: #!/bin/sh # # /etc/X11/Xsession # # global Xsession file -- used by display managers and xinit (startx)  # $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $  set -e  PROGNAME=Xsession  mes...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;#!/bin/sh&lt;br /&gt;
#&lt;br /&gt;
# /etc/X11/Xsession&lt;br /&gt;
#&lt;br /&gt;
# global Xsession file -- used by display managers and xinit (startx)&lt;br /&gt;
&lt;br /&gt;
# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $&lt;br /&gt;
&lt;br /&gt;
set -e&lt;br /&gt;
&lt;br /&gt;
PROGNAME=Xsession&lt;br /&gt;
&lt;br /&gt;
message () {&lt;br /&gt;
  # pretty-print messages of arbitrary length; use xmessage if it&lt;br /&gt;
  # is available and $DISPLAY is set&lt;br /&gt;
  MESSAGE=&amp;quot;$PROGNAME: $*&amp;quot;&lt;br /&gt;
  echo &amp;quot;$MESSAGE&amp;quot; | fold -s -w ${COLUMNS:-80} &amp;gt;&amp;amp;2&lt;br /&gt;
  if [ -n &amp;quot;$DISPLAY&amp;quot; ] &amp;amp;&amp;amp; which xmessage &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    echo &amp;quot;$MESSAGE&amp;quot; | fold -s -w ${COLUMNS:-80} | xmessage -center -file -&lt;br /&gt;
  fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
message_nonl () {&lt;br /&gt;
  # pretty-print messages of arbitrary length (no trailing newline); use&lt;br /&gt;
  # xmessage if it is available and $DISPLAY is set&lt;br /&gt;
  MESSAGE=&amp;quot;$PROGNAME: $*&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;$MESSAGE&amp;quot; | fold -s -w ${COLUMNS:-80} &amp;gt;&amp;amp;2;&lt;br /&gt;
  if [ -n &amp;quot;$DISPLAY&amp;quot; ] &amp;amp;&amp;amp; which xmessage &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then&lt;br /&gt;
    echo -n &amp;quot;$MESSAGE&amp;quot; | fold -s -w ${COLUMNS:-80} | xmessage -center -file -&lt;br /&gt;
  fi&lt;br /&gt;
}&lt;br /&gt;
errormsg () {&lt;br /&gt;
  # exit script with error&lt;br /&gt;
  message &amp;quot;$*&amp;quot;&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
internal_errormsg () {&lt;br /&gt;
  # exit script with error; essentially a &amp;quot;THIS SHOULD NEVER HAPPEN&amp;quot; message&lt;br /&gt;
  # One big call to message() for the sake of xmessage; if we had two then&lt;br /&gt;
  # the user would have dismissed the error we want reported before seeing the&lt;br /&gt;
  # request to report it.&lt;br /&gt;
  errormsg &amp;quot;$*&amp;quot; \&lt;br /&gt;
           &amp;quot;Please report the installed version of the \&amp;quot;x11-common\&amp;quot;&amp;quot; \&lt;br /&gt;
           &amp;quot;package and the complete text of this error message to&amp;quot; \&lt;br /&gt;
           &amp;quot;&amp;lt;debian-x@lists.debian.org&amp;gt;.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# initialize variables for use by all session scripts&lt;br /&gt;
&lt;br /&gt;
OPTIONFILE=/etc/X11/Xsession.options&lt;br /&gt;
&lt;br /&gt;
SYSRESOURCES=/etc/X11/Xresources&lt;br /&gt;
USRRESOURCES=$HOME/.Xresources&lt;br /&gt;
&lt;br /&gt;
SYSSESSIONDIR=/etc/X11/Xsession.d&lt;br /&gt;
USERXSESSION=$HOME/.xsession&lt;br /&gt;
USERXSESSIONRC=$HOME/.xsessionrc&lt;br /&gt;
ALTUSERXSESSION=$HOME/.Xsession&lt;br /&gt;
ERRFILE=$HOME/.xsession-errors&lt;br /&gt;
&lt;br /&gt;
# attempt to create an error file; abort if we cannot&lt;br /&gt;
if (umask 077 &amp;amp;&amp;amp; touch &amp;quot;$ERRFILE&amp;quot;) 2&amp;gt; /dev/null &amp;amp;&amp;amp; [ -w &amp;quot;$ERRFILE&amp;quot; ] &amp;amp;&amp;amp;&lt;br /&gt;
  [ ! -L &amp;quot;$ERRFILE&amp;quot; ]; then&lt;br /&gt;
  chmod 600 &amp;quot;$ERRFILE&amp;quot;&lt;br /&gt;
elif ERRFILE=$(tempfile 2&amp;gt; /dev/null); then&lt;br /&gt;
  if ! ln -sf &amp;quot;$ERRFILE&amp;quot; &amp;quot;${TMPDIR:=/tmp}/xsession-$USER&amp;quot;; then&lt;br /&gt;
    message &amp;quot;warning: unable to symlink \&amp;quot;$TMPDIR/xsession-$USER\&amp;quot; to&amp;quot; \&lt;br /&gt;
             &amp;quot;\&amp;quot;$ERRFILE\&amp;quot;; look for session log/errors in&amp;quot; \&lt;br /&gt;
             &amp;quot;\&amp;quot;$TMPDIR/xsession-$USER\&amp;quot;.&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
else&lt;br /&gt;
  errormsg &amp;quot;unable to create X session log/error file; aborting.&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# truncate ERRFILE if it is too big to avoid disk usage DoS&lt;br /&gt;
if [ &amp;quot;`stat -c%s \&amp;quot;$ERRFILE\&amp;quot;`&amp;quot; -gt 500000 ]; then&lt;br /&gt;
  T=`mktemp -p &amp;quot;$HOME&amp;quot;`&lt;br /&gt;
  tail -c 500000 &amp;quot;$ERRFILE&amp;quot; &amp;gt; &amp;quot;$T&amp;quot; &amp;amp;&amp;amp; mv -f &amp;quot;$T&amp;quot; &amp;quot;$ERRFILE&amp;quot; || rm -f &amp;quot;$T&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec &amp;gt;&amp;gt;&amp;quot;$ERRFILE&amp;quot; 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;$PROGNAME: X session started for $LOGNAME at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# sanity check; is our session script directory present?&lt;br /&gt;
if [ ! -d &amp;quot;$SYSSESSIONDIR&amp;quot; ]; then&lt;br /&gt;
  errormsg &amp;quot;no \&amp;quot;$SYSSESSIONDIR\&amp;quot; directory found; aborting.&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Attempt to create a file of non-zero length in /tmp; a full filesystem can&lt;br /&gt;
# cause mysterious X session failures.  We do not use touch, :, or test -w&lt;br /&gt;
# because they won&amp;#039;t actually create a file with contents.  We also let standard&lt;br /&gt;
# error from tempfile and echo go to the error file to aid the user in&lt;br /&gt;
# determining what went wrong.&lt;br /&gt;
WRITE_TEST=$(tempfile)&lt;br /&gt;
if ! echo &amp;quot;*&amp;quot; &amp;gt;&amp;gt;&amp;quot;$WRITE_TEST&amp;quot;; then&lt;br /&gt;
  message &amp;quot;warning: unable to write to ${WRITE_TEST%/*}; X session may exit&amp;quot; \&lt;br /&gt;
          &amp;quot;with an error&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
rm -f &amp;quot;$WRITE_TEST&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# use run-parts to source every file in the session directory; we source&lt;br /&gt;
# instead of executing so that the variables and functions defined above&lt;br /&gt;
# are available to the scripts, and so that they can pass variables to each&lt;br /&gt;
# other&lt;br /&gt;
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)&lt;br /&gt;
if [ -n &amp;quot;$SESSIONFILES&amp;quot; ]; then&lt;br /&gt;
  set +e&lt;br /&gt;
  for SESSIONFILE in $SESSIONFILES; do&lt;br /&gt;
    . $SESSIONFILE&lt;br /&gt;
  done&lt;br /&gt;
  set -e&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&lt;br /&gt;
# vim:set ai et sts=2 sw=2 tw=80:&lt;/div&gt;</summary>
		<author><name>Jbkorth07</name></author>
	</entry>
</feed>