]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - debian/lightdm-session
Launchpad automatic translations update.
[sojka/lightdm.git] / debian / lightdm-session
1 #!/bin/sh
2 #
3 # LightDM wrapper to run around X sessions.
4
5 echo "Running X session wrapper"
6
7 message () {
8   # pretty-print messages of arbitrary length; use xmessage if it
9   # is available and $DISPLAY is set
10   MESSAGE="$PROGNAME: $*"
11   echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
12   if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
13     echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
14   fi
15 }
16
17 errormsg () {
18   # exit script with error
19   message "$*"
20   exit 1
21 }
22
23 # Load profile
24 for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
25     if [ -f "$file" ]; then
26         echo "Loading profile from $file";
27         . "$file"
28     fi
29 done
30
31 # Load resources
32 if type xrdb >/dev/null 2>&1; then
33     xresourcedir="/etc/X11/Xresources"
34     if [ -d "$xresourcedir" ]; then
35         for file in $xresourcedir/*; do
36             echo "Loading resource: $file"
37             xrdb -nocpp -merge "$file"
38         done
39     fi
40     xresourcefile="$HOME/.Xresources"
41     if [ -f "$xresourcefile" ]; then
42         echo "Loading resource: $xresourcefile"
43         xrdb -nocpp -merge "$xresourcefile"
44     fi
45 fi    
46
47 # Load keymaps
48 if type setxkbmap >/dev/null 2>&1; then
49     for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
50         if [ -f "$file" ]; then
51             echo "Loading keymap: $file"
52             setxkbmap `cat "$file"`
53             XKB_IN_USE=yes
54         fi
55     done
56 fi
57
58 # Load xmodmap if not using XKB
59 if type xmodmap >/dev/null 2>&1; then
60     if [ -z "$XKB_IN_USE" ]; then
61         for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
62             if [ -f "$file" ]; then
63                echo "Loading modmap: $file"
64                xmodmap "$file"
65             fi
66         done
67     fi
68 fi
69
70 unset XKB_IN_USE
71
72 # Run all system xinitrc shell scripts.
73 xinitdir="/etc/X11/xinit/xinitrc.d"
74 if [ -d "$xinitdir" ]; then
75     for script in $xinitdir/*; do
76         echo "Loading xinit script $script"
77         if [ -x "$script" -a ! -d "$script" ]; then
78             . "$script"
79         fi
80     done
81 fi
82
83 # Load Xsession scripts
84 # OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
85 # by the scripts to work
86 xsessionddir="/etc/X11/Xsession.d"
87 OPTIONFILE=/etc/X11/Xsession.options
88 USERXSESSION=$HOME/.xsession
89 USERXSESSIONRC=$HOME/.xsessionrc
90 ALTUSERXSESSION=$HOME/.Xsession
91
92 if [ -d "$xsessionddir" ]; then
93     for i in `ls $xsessionddir`; do
94         script="$xsessionddir/$i"
95         echo "Loading X session script $script"
96         if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
97             . "$script"
98         fi
99     done
100 fi
101
102 echo "X session wrapper complete, running session $@"
103
104 exec $@