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