Blame SOURCES/Xclients

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