Blame SOURCES/Xclients

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