##########################################################################
# file:        SessionInit
# description: Session initialization code common to all session scripts.
#
# This file is to be sourced at the begining of all session scripts in
# the /etc/X11/gdm/Sessions directory. It must be sourced, not executed
# as a child process, for the environment variables and redirection to
# initialize properly.               
#
##########################################################################

# Set the $WM variable to contain the name of the window manager to exec.
script=$0
if [ -L $script ]; then script=`file $script | awk '{print $NF}'`; fi
WM=`echo $script | tr '[:upper:]' '[:lower:]'`
export WM=`basename $WM`

# Redirect errors to a file in user's home directory if we can.
for errfile in "$HOME/.$WM-errors" "/tmp/$WM-$USER"
do
        if ( cp /dev/null "$errfile" 2> /dev/null )
        then
                chmod 600 "$errfile"
                exec > "$errfile" 2>&1
                break
        fi
done

# Store the language as set by gdm.
gdmlang=$LANG


