1XCOMM!SHELL_CMD
2XCOMM
3
4XCOMM redirect errors to a file in user's home directory if we can
5
6errfile="$HOME/.xsession-errors"
7if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
8then
9	exec > "$errfile" 2>&1
10else
11    mktemp="MKTEMP_COMMAND"
12    if [ "x$mktemp" != "x" -a -x "$mktemp" ]
13    then
14	for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
15	do
16		if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)"
17		then
18			exec > "$ef" 2>&1
19			mv "$ef" "$errfile" 2> /dev/null
20			break
21		fi
22	done
23    else
24XCOMM Since this system doesn't have a mktemp command to allow secure
25XCOMM creation of files in shared directories, no fallback error log
26XCOMM is being used.   See https://bugs.freedesktop.org/show_bug.cgi?id=5898
27XCOMM
28XCOMM 	for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
29XCOMM	do
30XCOMM		if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
31XCOMM		then
32XCOMM			exec > "$errfile" 2>&1
33XCOMM			break
34XCOMM		fi
35XCOMM	done
36
37	exec > /dev/null 2>&1
38    fi
39fi
40
41case $# in
421)
43	case $1 in
44	failsafe)
45		exec BINDIR/xterm -geometry 80x24-0-0
46		;;
47	esac
48esac
49
50XCOMM The startup script is not intended to have arguments.
51
52startup=$HOME/.xsession
53resources=$HOME/.Xresources
54
55if [ -s "$startup" ]; then
56	if [ -x "$startup" ]; then
57		exec "$startup"
58	else
59		exec /bin/sh "$startup"
60	fi
61else
62	if [ -r "$resources" ]; then
63		BINDIR/xrdb -load "$resources"
64	fi
65	exec BINDIR/xsm
66fi
67