1 |
chithanh 11/11/16 21:49:59 |
2 |
|
3 |
Added: xdm.initd-4 |
4 |
Log: |
5 |
Add dependency on libXrender when building dmx, bug #390697. Prevent dbus from starting too late, bug #390609. |
6 |
|
7 |
(Portage version: 2.2.0_alpha72/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 x11-base/xorg-server/files/xdm.initd-4 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-base/xorg-server/files/xdm.initd-4?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-base/xorg-server/files/xdm.initd-4?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: xdm.initd-4 |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Copyright 1999-2011 Gentoo Foundation |
19 |
# Distributed under the terms of the GNU General Public License, v2 |
20 |
# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-4,v 1.1 2011/11/16 21:49:59 chithanh Exp $ |
21 |
|
22 |
# This is here to serve as a note to myself, and future developers. |
23 |
# |
24 |
# Any Display manager (gdm,kdm,xdm) has the following problem: if |
25 |
# it is started before any getty, and no vt is specified, it will |
26 |
# usually run on vt2. When the getty on vt2 then starts, and the |
27 |
# DM is already started, the getty will take control of the keyboard, |
28 |
# leaving us with a "dead" keyboard. |
29 |
# |
30 |
# Resolution: add the following line to /etc/inittab |
31 |
# |
32 |
# x:a:once:/etc/X11/startDM.sh |
33 |
# |
34 |
# and have /etc/X11/startDM.sh start the DM in daemon mode if |
35 |
# a lock is present (with the info of what DM should be started), |
36 |
# else just fall through. |
37 |
# |
38 |
# How this basically works, is the "a" runlevel is a additional |
39 |
# runlevel that you can use to fork processes with init, but the |
40 |
# runlevel never gets changed to this runlevel. Along with the "a" |
41 |
# runlevel, the "once" key word means that startDM.sh will only be |
42 |
# run when we specify it to run, thus eliminating respawning |
43 |
# startDM.sh when "xdm" is not added to the default runlevel, as was |
44 |
# done previously. |
45 |
# |
46 |
# This script then just calls "telinit a", and init will run |
47 |
# /etc/X11/startDM.sh after the current runlevel completes (this |
48 |
# script should only be added to the actual runlevel the user is |
49 |
# using). |
50 |
# |
51 |
# Martin Schlemmer |
52 |
# aka Azarah |
53 |
# 04 March 2002 |
54 |
|
55 |
depend() { |
56 |
need localmount xdm-setup |
57 |
|
58 |
# this should start as early as possible |
59 |
# we can't do 'before *' as that breaks it |
60 |
# (#139824) Start after ypbind and autofs for network authentication |
61 |
# (#145219 #180163) Could use lirc mouse as input device |
62 |
# (#70689 comment #92) Start after consolefont to avoid display corruption |
63 |
# (#291269) Start after quota, since some dm need readable home |
64 |
# (#390609) gdm-3 will fail when dbus is not running |
65 |
after bootmisc consolefont modules netmount |
66 |
after readahead-list ypbind autofs openvpn gpm lircmd |
67 |
after quota |
68 |
after dbus |
69 |
before alsasound |
70 |
|
71 |
# Start before X |
72 |
use consolekit xfs |
73 |
} |
74 |
|
75 |
setup_dm() { |
76 |
local MY_XDM |
77 |
|
78 |
MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]') |
79 |
|
80 |
# Load our root path from profile.env |
81 |
# Needed for kdm |
82 |
PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}") |
83 |
|
84 |
NAME= |
85 |
case "${MY_XDM}" in |
86 |
kdm|kde) |
87 |
EXE="$(which kdm)" |
88 |
PIDFILE=/var/run/kdm.pid |
89 |
;; |
90 |
kdm-*) |
91 |
EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm" |
92 |
PIDFILE=/var/run/kdm.pid |
93 |
;; |
94 |
entrance*) |
95 |
EXE=/usr/sbin/entranced |
96 |
PIDFILE=/var/lib/entranced.pid |
97 |
;; |
98 |
gdm|gnome) |
99 |
EXE=/usr/bin/gdm |
100 |
[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary |
101 |
PIDFILE=/var/run/gdm.pid |
102 |
;; |
103 |
wdm) |
104 |
EXE=/usr/bin/wdm |
105 |
PIDFILE= |
106 |
;; |
107 |
gpe) |
108 |
EXE=/usr/bin/gpe-dm |
109 |
PIDFILE=/var/run/gpe-dm.pid |
110 |
;; |
111 |
lxdm) |
112 |
EXE=/usr/sbin/lxdm-binary |
113 |
PIDFILE=/var/run/lxdm.pid |
114 |
START_STOP_ARGS="--background" |
115 |
;; |
116 |
lightdm) |
117 |
EXE=/usr/sbin/lightdm |
118 |
PIDFILE=/var/run/lightdm.pid |
119 |
START_STOP_ARGS="--background" |
120 |
;; |
121 |
*) |
122 |
# first find out if there is such executable |
123 |
EXE="$(which ${MY_XDM} 2>/dev/null)" |
124 |
PIDFILE="/var/run/${MY_XDM}.pid" |
125 |
|
126 |
# warn user that he is doing sick things if the exe was not found |
127 |
if [ -z "${EXE}" ]; then |
128 |
echo "ERROR: Your XDM value is invalid." |
129 |
echo " No ${MY_XDM} executable could be found on your system." |
130 |
fi |
131 |
;; |
132 |
esac |
133 |
|
134 |
if ! [ -x "${EXE}" ]; then |
135 |
EXE=/usr/bin/xdm |
136 |
PIDFILE=/var/run/xdm.pid |
137 |
if ! [ -x "/usr/bin/xdm" ]; then |
138 |
echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm," |
139 |
echo " or install x11-apps/xdm package" |
140 |
eend 255 |
141 |
fi |
142 |
fi |
143 |
} |
144 |
|
145 |
# Check to see if something is defined on our VT |
146 |
vtstatic() { |
147 |
if [ -e /etc/inittab ] ; then |
148 |
grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab |
149 |
elif [ -e /etc/ttys ] ; then |
150 |
grep -q "^ttyv$(($1 - 1))" /etc/ttys |
151 |
else |
152 |
return 1 |
153 |
fi |
154 |
} |
155 |
|
156 |
start() { |
157 |
local EXE NAME PIDFILE |
158 |
setup_dm |
159 |
|
160 |
if [ -f /etc/.noxdm ]; then |
161 |
einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed." |
162 |
rm /etc/.noxdm |
163 |
return 0 |
164 |
fi |
165 |
|
166 |
ebegin "Setting up ${EXE##*/}" |
167 |
|
168 |
# save the prefered DM |
169 |
save_options "service" "${EXE}" |
170 |
save_options "name" "${NAME}" |
171 |
save_options "pidfile" "${PIDFILE}" |
172 |
save_options "start_stop_args" "${START_STOP_ARGS}" |
173 |
|
174 |
if [ -n "${CHECKVT-y}" ] ; then |
175 |
if vtstatic "${CHECKVT:-7}" ; then |
176 |
if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then |
177 |
ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later" |
178 |
telinit a >/dev/null 2>&1 |
179 |
return 0 |
180 |
else |
181 |
eerror "Something is already defined on VT ${CHECKVT:-7}, not starting" |
182 |
return 1 |
183 |
fi |
184 |
fi |
185 |
fi |
186 |
|
187 |
/etc/X11/startDM.sh |
188 |
eend 0 |
189 |
} |
190 |
|
191 |
stop() { |
192 |
local curvt retval |
193 |
|
194 |
retval=0 |
195 |
if [ -t 0 ]; then |
196 |
if type fgconsole >/dev/null 2>&1; then |
197 |
curvt=$(fgconsole 2>/dev/null) |
198 |
else |
199 |
curvt=$(tty) |
200 |
case "${curvt}" in |
201 |
/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;; |
202 |
*) curvt= ;; |
203 |
esac |
204 |
fi |
205 |
fi |
206 |
local myexe myname mypidfile myservice |
207 |
myexe=$(get_options "service") |
208 |
myname=$(get_options "name") |
209 |
mypidfile=$(get_options "pidfile") |
210 |
myservice=${myexe##*/} |
211 |
|
212 |
[ -z "${myexe}" ] && return 0 |
213 |
|
214 |
ebegin "Stopping ${myservice}" |
215 |
|
216 |
if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then |
217 |
start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \ |
218 |
${mypidfile:+--pidfile} ${mypidfile} \ |
219 |
${myname:+--name} ${myname} |
220 |
retval=${?} |
221 |
fi |
222 |
|
223 |
# switch back to original vt |
224 |
if [ -n "${curvt}" ]; then |
225 |
if type chvt >/dev/null 2>&1; then |
226 |
chvt "${curvt}" |
227 |
else |
228 |
vidcontrol -s "$((curvt + 1))" |
229 |
fi |
230 |
fi |
231 |
|
232 |
eend ${retval} "Error stopping ${myservice}" |
233 |
return ${retval} |
234 |
} |
235 |
|
236 |
# vim: set ts=4 : |