2009-08-26 17:00:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
|
|
|
|
# redirect errors to a file in user's home directory if we can
|
2019-03-03 23:03:39 +01:00
|
|
|
|
|
|
|
errfile="$HOME/.xsession-errors"
|
|
|
|
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
|
|
|
|
then
|
|
|
|
exec > "$errfile" 2>&1
|
|
|
|
else
|
|
|
|
mktemp="/usr/bin/mktemp"
|
|
|
|
if [ "x$mktemp" != "x" -a -x "$mktemp" ]
|
|
|
|
then
|
|
|
|
for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
|
|
|
|
do
|
|
|
|
if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)"
|
|
|
|
then
|
|
|
|
exec > "$ef" 2>&1
|
|
|
|
mv "$ef" "$errfile" 2> /dev/null
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
|
|
|
# Since this system doesn't have a mktemp command to allow secure
|
|
|
|
# creation of files in shared directories, no fallback error log
|
|
|
|
# is being used. See https://bugs.freedesktop.org/show_bug.cgi?id=5898
|
|
|
|
#
|
|
|
|
# for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
|
|
|
|
# do
|
|
|
|
# if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
|
|
|
|
# then
|
|
|
|
# exec > "$errfile" 2>&1
|
|
|
|
# break
|
|
|
|
# fi
|
|
|
|
# done
|
|
|
|
|
|
|
|
exec > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
case $# in
|
|
|
|
1)
|
|
|
|
case $1 in
|
|
|
|
failsafe)
|
2019-03-03 23:03:39 +01:00
|
|
|
exec /usr/bin/xterm -geometry 80x24-0-0
|
2009-08-26 17:00:38 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
2019-03-03 23:03:39 +01:00
|
|
|
# The startup script is not intended to have arguments.
|
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
startup=$HOME/.xsession
|
|
|
|
resources=$HOME/.Xresources
|
|
|
|
|
2019-03-03 23:03:39 +01:00
|
|
|
if [ -s "$startup" ]; then
|
|
|
|
if [ -x "$startup" ]; then
|
|
|
|
exec "$startup"
|
|
|
|
else
|
|
|
|
exec /bin/sh "$startup"
|
|
|
|
fi
|
2009-08-26 17:00:38 +02:00
|
|
|
else
|
|
|
|
if [ -r "$resources" ]; then
|
2019-03-03 23:03:39 +01:00
|
|
|
/usr/bin/xrdb -load "$resources"
|
2009-08-26 17:00:38 +02:00
|
|
|
fi
|
2019-03-03 23:03:39 +01:00
|
|
|
exec /usr/bin/xsm
|
2009-08-26 17:00:38 +02:00
|
|
|
fi
|