Blame SOURCES/Xclients

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