2005-11-13 06:22:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
|
|
|
|
# copyrighted material is made available to anyone wishing to use, modify,
|
|
|
|
# copy, or redistribute it subject to the terms and conditions of the
|
|
|
|
# GNU General Public License version 2.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
# redirect errors to a file in user's home directory if we can
|
|
|
|
if [ -z "$GDMSESSION" ]; then
|
|
|
|
# GDM redirect output itself in a smarter fashion
|
|
|
|
errfile="$HOME/.xsession-errors"
|
2007-08-06 17:41:06 +00:00
|
|
|
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ); then
|
2005-11-13 06:22:11 +00:00
|
|
|
chmod 600 "$errfile"
|
|
|
|
exec > "$errfile" 2>&1
|
|
|
|
else
|
|
|
|
errfile=$(mktemp -q /tmp/xses-$USER.XXXXXX)
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
exec > "$errfile" 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
SWITCHDESKPATH=/usr/share/switchdesk
|
|
|
|
|
|
|
|
# Mandatorily source xinitrc-common, which is common code shared between the
|
|
|
|
# Xsession and xinitrc scripts which has been factored out to avoid duplication
|
|
|
|
. /etc/X11/xinit/xinitrc-common
|
|
|
|
|
|
|
|
# This Xsession.d implementation, is intended to obsolte and replace the
|
|
|
|
# various mechanisms present in the 'case' statement which follows, and to
|
|
|
|
# eventually be able to easily remove all hard coded window manager specific
|
|
|
|
# content from this script. See bug #142260 for additional explanation and
|
|
|
|
# details. All window manager rpm packages and desktop environment
|
|
|
|
# packages should be modified to provide the Xsession.d/Xsession.$wm scripts
|
|
|
|
# to start themselves up. In the future, the legacy switchdesk mechanisms
|
|
|
|
# and hard coded window managers and desktop environments will be removed from
|
|
|
|
# this script.
|
|
|
|
XCLIENTS_D=/etc/X11/xinit/Xclients.d
|
|
|
|
if [ -d "$XCLIENTS_D" -a "$#" -eq 1 -a -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
|
2008-02-04 18:49:27 +00:00
|
|
|
exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
|
2005-11-13 06:22:11 +00:00
|
|
|
else
|
|
|
|
# now, we see if xdm/gdm/kdm has asked for a specific environment
|
|
|
|
case $# in
|
|
|
|
1)
|
|
|
|
if [ -x "$SWITCHDESKPATH/Xclients.$1" ]; then
|
2007-10-23 18:46:49 +00:00
|
|
|
exec -l $SHELL -c "$SWITCHDESKPATH/Xclients.$1";
|
2005-11-13 06:22:11 +00:00
|
|
|
fi;
|
|
|
|
|
|
|
|
case "$1" in
|
2007-07-29 23:09:50 +00:00
|
|
|
failsafe)
|
|
|
|
exec -l $SHELL -c "xterm -geometry 80x24-0-0"
|
|
|
|
;;
|
2008-08-25 13:49:15 +00:00
|
|
|
gnome|gnome-session)
|
2008-04-08 21:20:03 +00:00
|
|
|
# lack of SSH_AGENT is intentional, see #441123. though
|
|
|
|
# the whole thing should really happen in xinitrc.d anyway.
|
|
|
|
exec -l $SHELL -c gnome-session
|
|
|
|
exec /bin/sh -c "exec -l $SHELL -c \"gnome-session\""
|
2007-07-29 23:09:50 +00:00
|
|
|
;;
|
|
|
|
kde|kde1|kde2)
|
2008-02-04 18:49:27 +00:00
|
|
|
exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"startkde\""
|
2007-07-29 23:09:50 +00:00
|
|
|
;;
|
|
|
|
twm)
|
2005-11-13 06:22:11 +00:00
|
|
|
# fall back to twm
|
2008-02-04 18:49:27 +00:00
|
|
|
exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"twm\""
|
2007-07-29 23:09:50 +00:00
|
|
|
;;
|
|
|
|
*)
|
2005-11-13 06:22:11 +00:00
|
|
|
# GDM provies either a command line as the first argument or
|
|
|
|
# provides 'failsafe', 'default' or 'custom'. KDM will do the
|
|
|
|
# same at some point
|
2007-07-29 23:09:50 +00:00
|
|
|
if [ "$1" != "default" -a "$1" != "custom" ]; then
|
2008-02-04 18:49:27 +00:00
|
|
|
exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$1\""
|
2007-07-29 23:09:50 +00:00
|
|
|
fi
|
|
|
|
;;
|
2005-11-13 06:22:11 +00:00
|
|
|
esac
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# otherwise, take default action
|
|
|
|
if [ -x "$HOME/.xsession" ]; then
|
2008-02-04 18:49:27 +00:00
|
|
|
exec -l $SHELL -c "$SSH_AGENT $HOME/.xsession"
|
2005-11-13 06:22:11 +00:00
|
|
|
elif [ -x "$HOME/.Xclients" ]; then
|
2008-02-04 18:49:27 +00:00
|
|
|
exec -l $SHELL -c "$SSH_AGENT $HOME/.Xclients"
|
2005-11-13 06:22:11 +00:00
|
|
|
elif [ -x /etc/X11/xinit/Xclients ]; then
|
2008-02-04 18:49:27 +00:00
|
|
|
exec -l $SHELL -c "$SSH_AGENT /etc/X11/xinit/Xclients"
|
2005-11-13 06:22:11 +00:00
|
|
|
else
|
|
|
|
# should never get here; failsafe fallback
|
|
|
|
exec -l $SHELL -c "xsm"
|
|
|
|
fi
|
|
|
|
|