Adding upstream version 0.4.1.
[debian/lxdm.git] / data / Xsession
1 #!/bin/bash
2
3 # use bash for "exec -l", howto run login shell by /bin/sh ?
4
5 if [ $# -eq 1 -a -n "$1" ]; then
6         LXSESSION=$1
7 else
8 # default session
9         LXSESSION=/usr/bin/startlxde
10 fi
11
12 [ -f /etc/xprofile ] && . /etc/xprofile
13 [ -f ~/.xprofile ] && . ~/.xprofile
14
15 if [ -f /etc/X11/xinit/xinitrc-common ]; then
16 # fedora
17         . /etc/X11/xinit/xinitrc-common
18         if ! [ -z "$XDG_SESSION_COOKIE" ]; then
19                 CK_XINIT_SESSION=
20         elif [ -x /usr/bin/ck-launch-session -a -z "$CK_XINIT_SESSION" ]; then
21                 CK_XINIT_SESSION="/usr/bin/ck-launch-session"
22         fi
23         exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
24 elif [ -x /etc/X11/xinit/Xsession ]; then
25 # fedora
26         exec /etc/X11/xinit/Xsession "$LXSESSION"
27 elif [ -x /etc/X11/Xsession ]; then
28 # mandriva, debian, ubuntu
29         exec /etc/X11/Xsession "$LXSESSION"
30 elif [ -x /etc/X11/xinit/xinitrc ]; then
31 #suse
32         export WINDOWMANAGER=$LXSESSION
33         exec -l $SHELL -c /etc/X11/xinit/xinitrc
34 else
35 # unknown, user should custom /etc/lxdm/xinitrc self
36         if [ -x /etc/lxdm/xinitrc ]; then
37                 . /etc/lxdm/xinitrc
38         fi
39         if ! [ -z "$XDG_SESSION_COOKIE" ]; then
40                 CK_XINIT_SESSION=
41         elif [ -x /usr/bin/ck-launch-session ]; then
42                 CK_XINIT_SESSION="/usr/bin/ck-launch-session"
43         fi
44         exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
45 fi
46