2006-11-25 13:07:29 -07:00
|
|
|
XCOMM!SHELL_CMD
|
|
|
|
XCOMM
|
2014-02-25 15:16:24 -07:00
|
|
|
XCOMM $OpenBSD: Xsession.cpp,v 1.13 2014/02/25 22:16:24 matthieu Exp $
|
2006-11-25 13:07:29 -07:00
|
|
|
|
|
|
|
XCOMM redirect errors to a file in user's home directory if we can
|
2011-11-15 13:53:44 -07:00
|
|
|
|
|
|
|
errfile="$HOME/.xsession-errors"
|
|
|
|
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
|
|
|
|
then
|
|
|
|
exec > "$errfile" 2>&1
|
|
|
|
else
|
|
|
|
#ifdef MKTEMP_COMMAND
|
|
|
|
mktemp=MKTEMP_COMMAND
|
|
|
|
for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
|
|
|
|
do
|
|
|
|
if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)"
|
|
|
|
then
|
|
|
|
exec > "$ef" 2>&1
|
|
|
|
mv "$ef" "$errfile" 2> /dev/null
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
#else
|
|
|
|
XCOMM Since this system doesn't have a mktemp command to allow secure
|
|
|
|
XCOMM creation of files in shared directories, no fallback error log
|
|
|
|
XCOMM is being used. See https://bugs.freedesktop.org/show_bug.cgi?id=5898
|
|
|
|
XCOMM
|
|
|
|
XCOMM for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
|
|
|
|
XCOMM do
|
|
|
|
XCOMM if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
|
|
|
|
XCOMM then
|
|
|
|
XCOMM exec > "$errfile" 2>&1
|
|
|
|
XCOMM break
|
|
|
|
XCOMM fi
|
|
|
|
XCOMM done
|
|
|
|
|
|
|
|
exec > /dev/null 2>&1
|
|
|
|
|
|
|
|
#endif
|
|
|
|
fi
|
2006-11-25 13:07:29 -07:00
|
|
|
|
2006-11-28 08:41:12 -07:00
|
|
|
XCOMM if we have private ssh key(s), start ssh-agent and add the key(s)
|
|
|
|
id1=$HOME/.ssh/identity
|
|
|
|
id2=$HOME/.ssh/id_dsa
|
|
|
|
id3=$HOME/.ssh/id_rsa
|
2011-12-03 06:46:00 -07:00
|
|
|
id4=$HOME/.ssh/id_ecdsa
|
2014-02-25 15:16:24 -07:00
|
|
|
id5=$HOME/.ssh/id_ed25519
|
2013-05-19 01:22:53 -06:00
|
|
|
if [ -z "$SSH_AGENT_PID" ];
|
2006-11-25 13:07:29 -07:00
|
|
|
then
|
2014-02-25 15:16:24 -07:00
|
|
|
if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f $id4 -o -f $id5 ];
|
2013-05-19 01:22:53 -06:00
|
|
|
then
|
|
|
|
eval `ssh-agent -s`
|
|
|
|
ssh-add < /dev/null
|
|
|
|
fi
|
2006-11-25 13:07:29 -07:00
|
|
|
fi
|
|
|
|
|
2006-11-28 08:41:12 -07:00
|
|
|
do_exit() {
|
|
|
|
if [ "$SSH_AGENT_PID" ]; then
|
|
|
|
ssh-add -D < /dev/null
|
|
|
|
eval `ssh-agent -s -k`
|
|
|
|
fi
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2006-11-25 13:07:29 -07:00
|
|
|
case $# in
|
|
|
|
1)
|
|
|
|
case $1 in
|
|
|
|
failsafe)
|
2007-08-05 13:54:19 -06:00
|
|
|
BINDIR/xterm -geometry 80x24-0-0
|
|
|
|
do_exit
|
2006-11-25 13:07:29 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
2011-11-15 13:53:44 -07:00
|
|
|
XCOMM The startup script is not intended to have arguments.
|
2006-11-25 13:07:29 -07:00
|
|
|
|
|
|
|
startup=$HOME/.xsession
|
|
|
|
resources=$HOME/.Xresources
|
|
|
|
|
|
|
|
if [ -s "$startup" ]; then
|
|
|
|
if [ -x "$startup" ]; then
|
2007-08-05 13:54:19 -06:00
|
|
|
"$startup"
|
2006-11-25 13:07:29 -07:00
|
|
|
else
|
2007-08-05 13:54:19 -06:00
|
|
|
/bin/sh "$startup"
|
2006-11-25 13:07:29 -07:00
|
|
|
fi
|
|
|
|
else
|
2007-08-05 13:54:19 -06:00
|
|
|
if [ -f "$resources" ]; then
|
2006-11-25 13:07:29 -07:00
|
|
|
BINDIR/xrdb -load "$resources"
|
|
|
|
fi
|
|
|
|
#if defined(__SCO__) || defined(__UNIXWARE__)
|
|
|
|
[ -r /etc/default/xdesktops ] && {
|
|
|
|
. /etc/default/xdesktops
|
|
|
|
}
|
|
|
|
|
|
|
|
[ -r /etc/default/xdm ] && {
|
|
|
|
. /etc/default/xdm
|
|
|
|
}
|
|
|
|
|
|
|
|
XCOMM Allow the user to over-ride the system default desktop
|
|
|
|
[ -r $HOME/.xdmdesktop ] && {
|
|
|
|
. $HOME/.xdmdesktop
|
|
|
|
}
|
|
|
|
|
|
|
|
[ -n "$XDESKTOP" ] && {
|
|
|
|
exec `eval $XDESKTOP`
|
|
|
|
}
|
|
|
|
#endif
|
2013-05-02 23:57:05 -06:00
|
|
|
if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
|
2012-08-04 14:41:42 -06:00
|
|
|
eval `dbus-launch --sh-syntax --exit-with-session`
|
|
|
|
fi
|
2006-11-28 08:41:12 -07:00
|
|
|
BINDIR/xterm &
|
|
|
|
BINDIR/fvwm
|
2006-11-25 13:07:29 -07:00
|
|
|
fi
|
2007-08-05 13:54:19 -06:00
|
|
|
do_exit
|