192 |
- |
1 |
#!/bin/bash
|
|
|
2 |
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
|
|
|
3 |
# copyrighted material is made available to anyone wishing to use, modify,
|
|
|
4 |
# copy, or redistribute it subject to the terms and conditions of the
|
|
|
5 |
# GNU General Public License version 2.
|
|
|
6 |
#
|
|
|
7 |
# You should have received a copy of the GNU General Public License
|
|
|
8 |
# along with this program; if not, write to the Free Software
|
|
|
9 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
10 |
|
|
|
11 |
GSESSION="$(type -p gnome-session)"
|
|
|
12 |
MSESSION="$(type -p mate-session)"
|
|
|
13 |
STARTKDE="$(type -p startkde)"
|
|
|
14 |
STARTLXDE="$(type -p startlxde)"
|
|
|
15 |
|
|
|
16 |
# check to see if the user has a preferred desktop
|
|
|
17 |
PREFERRED=
|
|
|
18 |
if [ -f /etc/sysconfig/desktop ]; then
|
|
|
19 |
. /etc/sysconfig/desktop
|
|
|
20 |
if [ "$DESKTOP" = "GNOME" ]; then
|
|
|
21 |
PREFERRED="$GSESSION"
|
|
|
22 |
elif [ "$DESKTOP" = "MATE" ]; then
|
|
|
23 |
PREFERRED="$MSESSION"
|
|
|
24 |
elif [ "$DESKTOP" = "KDE" ]; then
|
|
|
25 |
PREFERRED="$STARTKDE"
|
|
|
26 |
elif [ "$DESKTOP" = "LXDE" ]; then
|
|
|
27 |
PREFERRED="$STARTLXDE"
|
|
|
28 |
fi
|
|
|
29 |
fi
|
|
|
30 |
|
|
|
31 |
if [ -n "$PREFERRED" ]; then
|
|
|
32 |
exec "$PREFERRED"
|
|
|
33 |
fi
|
|
|
34 |
|
|
|
35 |
# now if we can reach here, either no desktop file was present,
|
|
|
36 |
# or the desktop requested is not installed.
|
|
|
37 |
|
|
|
38 |
if [ -n "$GSESSION" ]; then
|
|
|
39 |
# by default, we run GNOME.
|
|
|
40 |
exec "$GSESSION"
|
|
|
41 |
elif [ -n "$STARTKDE" ]; then
|
|
|
42 |
# if GNOME isn't installed, try KDE.
|
|
|
43 |
exec "$STARTKDE"
|
|
|
44 |
elif [ -n "$STARTLXDE" ]; then
|
|
|
45 |
# if neither GNOME nor KDE then LXDE
|
|
|
46 |
exec "$STARTLXDE"
|
|
|
47 |
fi
|
|
|
48 |
|
|
|
49 |
# We should also support /etc/X11/xinit/Xclients.d scripts
|
|
|
50 |
XCLIENTS_D=/etc/X11/xinit/Xclients.d
|
|
|
51 |
if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
|
|
|
52 |
exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
|
|
|
53 |
fi
|
|
|
54 |
|
|
|
55 |
# Failsafe.
|
|
|
56 |
|
|
|
57 |
# these files are left sitting around by TheNextLevel.
|
|
|
58 |
rm -f $HOME/Xrootenv.0
|
|
|
59 |
|
|
|
60 |
# Argh! Nothing good is installed. Fall back to twm
|
|
|
61 |
{
|
|
|
62 |
# gosh, neither fvwm95 nor fvwm2 is available;
|
|
|
63 |
# fall back to failsafe settings
|
|
|
64 |
[ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
|
|
|
65 |
|
|
|
66 |
if [ -x /usr/bin/xclock ] ; then
|
|
|
67 |
/usr/bin/xclock -geometry 100x100-5+5 &
|
|
|
68 |
fi
|
|
|
69 |
if [ -x /usr/bin/xterm ] ; then
|
|
|
70 |
/usr/bin/xterm -geometry 80x50-50+150 &
|
|
|
71 |
fi
|
|
|
72 |
if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
|
|
|
73 |
/usr/bin/firefox /usr/share/doc/HTML/index.html &
|
|
|
74 |
fi
|
|
|
75 |
if [ -x /usr/bin/twm ] ; then
|
|
|
76 |
exec /usr/bin/twm
|
|
|
77 |
fi
|
|
|
78 |
}
|