3 # use bash for "exec -l", howto run login shell by /bin/sh ?
4 PROGNAME
=/etc
/lxdm
/Xsession
7 # pretty-print messages of arbitrary length; use xmessage if it
8 # is available and $DISPLAY is set
9 MESSAGE
="$PROGNAME: $*"
10 echo "$MESSAGE" |
fold -s -w ${COLUMNS:-80} >&2
11 if [ -n "$DISPLAY" ] && which xmessage
> /dev
/null
2>&1; then
12 echo "$MESSAGE" |
fold -s -w ${COLUMNS:-80} | xmessage
-center -file -
17 # pretty-print messages of arbitrary length (no trailing newline); use
18 # xmessage if it is available and $DISPLAY is set
19 MESSAGE
="$PROGNAME: $*"
20 echo -n "$MESSAGE" |
fold -s -w ${COLUMNS:-80} >&2;
21 if [ -n "$DISPLAY" ] && which xmessage
> /dev
/null
2>&1; then
22 echo -n "$MESSAGE" |
fold -s -w ${COLUMNS:-80} | xmessage
-center -file -
27 # exit script with error
32 # attempt to create an error file; abort if we cannot
33 ERRFILE
=$HOME/.xsession-errors
34 if (umask 077 && touch "$ERRFILE") 2> /dev
/null
&& [ -w "$ERRFILE" ] &&
35 [ ! -L "$ERRFILE" ]; then
37 elif ERRFILE
=$
(tempfile
2> /dev
/null
); then
38 if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
39 message
"warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
40 "\"$ERRFILE\"; look for session log/errors in" \
41 "\"$TMPDIR/xsession-$USER\"."
44 errormsg
"unable to create X session log/error file; aborting."
46 echo -n >"$ERRFILE" 2>&1
47 exec >>"$ERRFILE" 2>&1
49 # attempt to launch an xsession
50 if [ $# -eq 1 -a -n "$1" ]; then
51 # previously saved or default session
52 LXSESSION
=$
(which $1 >/dev
/null
2>&1)
53 if [ -z "$LXSESSION" ]; then
54 if [ -x /usr
/bin
/startxfce4
]; then
56 LXSESSION
=/usr
/bin
/startxfce4
57 elif [ -x $HOME/.xsession
]; then
59 LXSESSION
=$HOME/.xsession
64 if [ -x /etc
/X11
/xinit
/xinitrc-common
]; then
66 .
/etc
/X11
/xinit
/xinitrc-common
67 if ! [ -z "$XDG_SESSION_COOKIE" ]; then
69 elif [ -x /usr
/bin
/ck-launch-session
-a -z "$CK_XINIT_SESSION" ]; then
70 CK_XINIT_SESSION
="/usr/bin/ck-launch-session"
72 exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
73 elif [ -x /etc
/X11
/xinit
/Xsession
]; then
75 exec /etc
/X11
/xinit
/Xsession
$LXSESSION
76 elif [ -x /etc
/X11
/Xsession
]; then
77 # debian, mandriva, ubuntu
78 exec /etc
/X11
/Xsession
$LXSESSION
79 elif [ -x /etc
/X11
/xinit
/xinitrc
]; then
81 export WINDOWMANAGER
=$LXSESSION
82 exec -l $SHELL -c /etc
/X11
/xinitrc
84 # unknown, user should custom /etc/lxdm/xinitrc self
85 if [ -x /etc
/lxdm
/xinitrc
]; then
88 if ! [ -z "$XDG_SESSION_COOKIE" ]; then
90 elif [ -x /usr
/bin
/ck-launch-session
]; then
91 CK_XINIT_SESSION
="/usr/bin/ck-launch-session"
93 exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""