summarylogtreecommitdiffstats
path: root/Xsession
blob: 2fb07843080a398fa4454355c6ed0abf7f663b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
source /etc/xdm-hallo/xdm-hallo.rc

# provided by xlogin*login.translations:<Key>:set-session-argument()
case $# in
0)
	session_argument="userhome"
;;
*)
	session_argument=$*
;;
esac

# redirect errors to a file in user's home directory if we can

errfile=$XSESSION_ERR_PATH
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
then
	exec > "$errfile" 2>&1
else

	mktemp=/usr/bin/mktemp
	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
fi

case $session_argument in
userhome)
	# The startup script is not intended to have arguments.
	startup=$HOME/.xsession
	resources=$HOME/.Xresources
	xinitrc=$HOME/.xinitrc

	if [ -s "$startup" ]; then
		exec /bin/sh -ls -c "$startup"
	else
		if [ -r "$resources" ]; then
			/usr/bin/xrdb -load "$resources"
		fi
		if [ -r "$xinitrc" ]; then
			exec /bin/sh -ls -c "$xinitrc"
		else
			exec /bin/sh -l /etc/X11/xinit/xinitrc
		fi
	fi
;;
failsafe)
	exec /usr/bin/xterm -name login
;;
*)
	resources=$HOME/.Xresources
	if [ -r "$resources" ]; then
		/usr/bin/xrdb -load "$resources"
	fi
	exec /bin/sh -ls -c "$session_argument"
;;
esac