Blame | Last modification | View Log | RSS feed
#!/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 canif [ -z "$GDMSESSION" ]; then# GDM redirect output itself in a smarter fashionerrfile="$HOME/.xsession-errors"if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ); thenchmod 600 "$errfile"[ -x /sbin/restorecon ] && /sbin/restorecon $errfileexec > "$errfile" 2>&1elseerrfile=$(mktemp -q /tmp/xses-$USER.XXXXXX)if [ $? -eq 0 ]; thenexec > "$errfile" 2>&1fififiSWITCHDESKPATH=/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.dif [ -d "$XCLIENTS_D" -a "$#" -eq 1 -a -x "$XCLIENTS_D/Xclients.$1.sh" ]; thenexec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"else# now, we see if xdm/gdm/kdm has asked for a specific environmentcase $# in1)if [ -x "$SWITCHDESKPATH/Xclients.$1" ]; thenexec -l $SHELL -c "$SWITCHDESKPATH/Xclients.$1";fi;case "$1" infailsafe)exec -l $SHELL -c "xterm -geometry 80x24-0-0";;gnome|gnome-session)# lack of SSH_AGENT is intentional, see #441123. though# the whole thing should really happen in xinitrc.d anyway.exec -l $SHELL -c gnome-sessionexec /bin/sh -c "exec -l $SHELL -c \"gnome-session\"";;kde|kde1|kde2)exec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"startkde\"";;twm)# fall back to twmexec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"twm\"";;*)# GDM provies either a command line as the first argument or# provides 'failsafe', 'default' or 'custom'. KDM will do the# same at some pointif [ "$1" != "default" -a "$1" != "custom" ]; thenexec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$1\""fi;;esacesacfi# otherwise, take default actionif [ -x "$HOME/.xsession" ]; thenexec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.xsession"elif [ -x "$HOME/.Xclients" ]; thenexec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients"elif [ -x /etc/X11/xinit/Xclients ]; thenexec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients"else# should never get here; failsafe fallbackexec -l $SHELL -c "xsm"fi