Imported Upstream version 0.1.0
[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 if [ -x /etc/X11/xinit/xinitrc-common ]; then
13 # fedora
14         . /etc/X11/xinit/xinitrc-common
15         if ! [ -z "$XDG_SESSION_COOKIE" ]; then
16                 CK_XINIT_SESSION=
17         elif [ -x /usr/bin/ck-launch-session -a -z "$CK_XINIT_SESSION" ]; then
18                 CK_XINIT_SESSION="/usr/bin/ck-launch-session"
19         fi
20         exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
21 elif [ -x /etc/X11/xinit/Xsession ]; then
22 # fedora
23         exec /etc/X11/xinit/Xsession $LXSESSION
24 elif [ -x /etc/X11/Xsession ]; then
25 # mandriva, debian, ubuntu
26         exec /etc/X11/Xsession $LXSESSION
27 elif [ -x /etc/X11/xinit/xinitrc ]; then
28 #suse
29         export WINDOWMANAGER=$LXSESSION
30         exec -l $SHELL -c /etc/X11/xinitrc
31 else
32 # unknown, user should custom /etc/lxdm/xinitrc self
33         if [ -x /etc/lxdm/xinitrc ]; then
34                 . /etc/lxdm/xinitrc
35         fi
36         if ! [ -z "$XDG_SESSION_COOKIE" ]; then
37                 CK_XINIT_SESSION=
38         elif [ -x /usr/bin/ck-launch-session ]; then
39                 CK_XINIT_SESSION="/usr/bin/ck-launch-session"
40         fi
41         exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
42 fi
43