blob: 7ff14d5213b8921abc4f4df5b2c7ec7b6865bd73 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
#!/bin/sh
#
# Note that this is SORT OF LIKE an X session, but not quite. You get a
# .desktop file as the first argument. You must here then parse the
# Exec= line out of this file and use that.
# As a special case, the Exec line can be:
# failsafe - Run an xterm only
# Xclients - Run the appropriate Xclients startup (see the code below)
#
# You should also handle an argument of 'failsafe'
#
# Note that output is ALREADY redirected to .xsession-errors in GDM. This way
# .xsession-errors actually gets more output such as if the PreSession script
# is failing. We wish to be robust don't we?
#
# Also note that this is not run as a login shell, this is just executed.
# This is why we source the profile files below.
#
# based on:
# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
# First read /etc/profile and .profile
test -f /etc/profile && . /etc/profile
test -f $HOME/.profile && . $HOME/.profile
# Second read /etc/xprofile and .xprofile for X specific setup
test -f /etc/xprofile && . /etc/xprofile
test -f $HOME/.xprofile && . $HOME/.xprofile
zenity=`which zenity`
command=
if [ -z "$1" ] || [ x"$1" = xfailsafe ] ; then
command=failsafe
else
# Here we parse the .desktop file
command=`grep 'Exec=' "$1" | sed 's/^Exec=//'`
fi
if [ -z "$command" ] ; then
command=failsafe
fi
if [ x"$command" = xfailsafe ] ; then
if [ -n "$zenity" ] ; then
$zenity --info --text "This is the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
fi
exec xterm -geometry 80x24+0+0
fi
# Note: ~/.xsession-errors is now done in the daemon so that it
# works for ALL sessions (except ones named 'Failsafe')
# clean up after xbanner
if which freetemp 2> /dev/null ; then
freetemp
fi
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap
sysresources=/etc/X11/Xresources
sysmodmap=/etc/X11/Xmodmap
sysxkbmap=/etc/X11/Xkbmap
rh6sysresources=/etc/X11/xinit/Xresources
rh6sysmodmap=/etc/X11/xinit/Xmodmap
# merge in defaults
if [ -f "$rh6sysresources" ]; then
xrdb -merge "$rh6sysresources"
fi
if [ -f "$sysresources" ]; then
xrdb -merge "$sysresources"
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
# merge in keymaps
if [ -f "$sysxkbmap" ]; then
setxkbmap `cat "$sysxkbmap"`
XKB_IN_USE=yes
fi
if [ -f "$userxkbmap" ]; then
setxkbmap `cat "$userxkbmap"`
XKB_IN_USE=yes
fi
#
# Eeek, this seems like too much magic here
#
if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
if [ -n "$xkbsymbols" ]; then
setxkbmap -symbols "$xkbsymbols"
XKB_IN_USE=yes
fi
fi
fi
# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
if [ -f "$rh6sysmodmap" ]; then
xmodmap "$rh6sysmodmap"
fi
if [ -f "$sysmodmap" ]; then
xmodmap "$sysmodmap"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
fi
unset XKB_IN_USE
# Normalize languages, some places/distros screw us up in /etc/profile,
# so in case the user did select a language
if [ -n "$GDM_LANG" ]; then
LANG=$GDM_LANG
export LANG
if [ -n "$LC_ALL" ]; then
if [ "$LC_ALL" != "$LANG" ]; then
LC_ALL=$LANG
fi
else
unset LC_ALL
fi
if [ -n "$LANGUAGE" ]; then
if [ "$LANGUAGE" != "$LANG" ]; then
LANGUAGE=$LANG
fi
else
unset LANGUAGE
fi
if [ -n "$LINGUAS" ]; then
if [ "$LINGUAS" != "$LANG" ]; then
LINGUAS=$LANG
fi
else
unset LINGUAS
fi
fi
# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for i in /etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
done
fi
if [ "x$command" = "xXclients" ] ; then
if [ -x "$HOME/.Xclients" ]; then
command="$HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
command="/etc/X11/xinit/Xclients"
elif [ -x /etc/X11/Xclients ]; then
command="/etc/X11/Xclients"
else
echo "Cannot find Xclients"
fi
fi
# add ssh-agent if found
sshagent=`which ssh-agent`
if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
command="$sshagent -- $command"
fi
exec $command
echo "Executing: $command failed, will run xterm"
if [ -n "$zenity" ] ; then
$zenity --info --text "I could not start your session and so I have started the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
fi
exec xterm -geometry 80x24+0+0
|