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