|
|
741de5 |
#!/bin/bash
|
|
|
741de5 |
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
|
|
|
741de5 |
# copyrighted material is made available to anyone wishing to use, modify,
|
|
|
741de5 |
# copy, or redistribute it subject to the terms and conditions of the
|
|
|
741de5 |
# GNU General Public License version 2.
|
|
|
741de5 |
#
|
|
|
741de5 |
# You should have received a copy of the GNU General Public License
|
|
|
741de5 |
# along with this program; if not, write to the Free Software
|
|
|
741de5 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
741de5 |
|
|
|
741de5 |
GSESSION="$(type -p gnome-session)"
|
|
|
741de5 |
STARTKDE="$(type -p startkde)"
|
|
|
741de5 |
|
|
|
741de5 |
# check to see if the user has a preferred desktop
|
|
|
741de5 |
PREFERRED=
|
|
|
741de5 |
if [ -f /etc/sysconfig/desktop ]; then
|
|
|
741de5 |
. /etc/sysconfig/desktop
|
|
|
741de5 |
if [ "$DESKTOP" = "GNOME" ]; then
|
|
|
741de5 |
PREFERRED="$GSESSION"
|
|
|
741de5 |
elif [ "$DESKTOP" = "KDE" ]; then
|
|
|
741de5 |
PREFERRED="$STARTKDE"
|
|
|
741de5 |
fi
|
|
|
741de5 |
fi
|
|
|
741de5 |
|
|
|
741de5 |
if [ -n "$PREFERRED" ]; then
|
|
|
741de5 |
exec "$PREFERRED"
|
|
|
741de5 |
fi
|
|
|
741de5 |
|
|
|
741de5 |
# now if we can reach here, either no desktop file was present,
|
|
|
741de5 |
# or the desktop requested is not installed.
|
|
|
741de5 |
|
|
|
741de5 |
if [ -n "$GSESSION" ]; then
|
|
|
741de5 |
# by default, we run GNOME.
|
|
|
741de5 |
exec "$GSESSION"
|
|
|
741de5 |
elif [ -n "$STARTKDE" ]; then
|
|
|
741de5 |
# if GNOME isn't installed, try KDE.
|
|
|
741de5 |
exec "$STARTKDE"
|
|
|
741de5 |
fi
|
|
|
741de5 |
|
|
|
741de5 |
# We should also support /etc/X11/xinit/Xclients.d scripts
|
|
|
741de5 |
XCLIENTS_D=/etc/X11/xinit/Xclients.d
|
|
|
741de5 |
if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
|
|
|
741de5 |
exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
|
|
|
741de5 |
fi
|
|
|
741de5 |
|
|
|
741de5 |
# Failsafe.
|
|
|
741de5 |
|
|
|
741de5 |
# these files are left sitting around by TheNextLevel.
|
|
|
741de5 |
rm -f $HOME/Xrootenv.0
|
|
|
741de5 |
|
|
|
741de5 |
# Argh! Nothing good is installed. Fall back to twm
|
|
|
741de5 |
{
|
|
|
741de5 |
# gosh, neither fvwm95 nor fvwm2 is available;
|
|
|
741de5 |
# fall back to failsafe settings
|
|
|
741de5 |
[ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
|
|
|
741de5 |
|
|
|
741de5 |
if [ -x /usr/bin/xclock ] ; then
|
|
|
741de5 |
/usr/bin/xclock -geometry 100x100-5+5 &
|
|
|
741de5 |
fi
|
|
|
741de5 |
if [ -x /usr/bin/xterm ] ; then
|
|
|
741de5 |
/usr/bin/xterm -geometry 80x50-50+150 &
|
|
|
741de5 |
fi
|
|
|
741de5 |
if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
|
|
|
741de5 |
/usr/bin/firefox /usr/share/doc/HTML/index.html &
|
|
|
741de5 |
fi
|
|
|
741de5 |
if [ -x /usr/bin/twm ] ; then
|
|
|
741de5 |
exec /usr/bin/twm
|
|
|
741de5 |
fi
|
|
|
741de5 |
}
|