Blame SOURCES/Xclients

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