1 | #! /bin/sh
|
---|
2 | #
|
---|
3 | # Linux Additions X11 setup init script ($Revision: 68684 $)
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2012 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 |
|
---|
19 | # chkconfig: 35 30 70
|
---|
20 | # description: VirtualBox Linux Additions kernel modules
|
---|
21 | #
|
---|
22 | ### BEGIN INIT INFO
|
---|
23 | # Provides: vboxadd-x11
|
---|
24 | # Required-Start:
|
---|
25 | # Required-Stop:
|
---|
26 | # Default-Start:
|
---|
27 | # Default-Stop:
|
---|
28 | # Description: VirtualBox Linux Additions X11 setup
|
---|
29 | ### END INIT INFO
|
---|
30 |
|
---|
31 | PATH=$PATH:/bin:/sbin:/usr/sbin
|
---|
32 | LOG="/var/log/vboxadd-install-x11.log"
|
---|
33 | CONFIG_DIR="/var/lib/VBoxGuestAdditions"
|
---|
34 | CONFIG="${CONFIG_DIR}/config"
|
---|
35 | MODPROBE=/sbin/modprobe
|
---|
36 |
|
---|
37 | if $MODPROBE -c 2>/dev/null | grep -q '^allow_unsupported_modules *0'; then
|
---|
38 | MODPROBE="$MODPROBE --allow-unsupported-modules"
|
---|
39 | fi
|
---|
40 |
|
---|
41 | # Find the version of X installed
|
---|
42 | # The last of the three is for the X.org 6.7 included in Fedora Core 2
|
---|
43 | xver=`X -version 2>&1`
|
---|
44 | x_version=`echo "$xver" | sed -n 's/^X Window System Version \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^XFree86 Version \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^X Protocol Version 11, Revision 0, Release \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^X.Org X Server \([0-9.]\+\)/\1/p'`
|
---|
45 | x_version_short=`echo "${x_version}" | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/'`
|
---|
46 | # Version of Redhat or Fedora installed. Needed for setting up selinux policy.
|
---|
47 | redhat_release=`cat /etc/redhat-release 2> /dev/null`
|
---|
48 | # Version of OL installed. Needed for blacklisting vboxvideo.
|
---|
49 | oracle_release=`cat /etc/oracle-release 2> /dev/null`
|
---|
50 | # All the different possible locations for XFree86/X.Org configuration files
|
---|
51 | # - how many of these have ever been used?
|
---|
52 | x11conf_files="/etc/X11/xorg.conf /etc/X11/xorg.conf-4 /etc/X11/.xorg.conf \
|
---|
53 | /etc/xorg.conf /usr/etc/X11/xorg.conf-4 /usr/etc/X11/xorg.conf \
|
---|
54 | /usr/lib/X11/xorg.conf-4 /usr/lib/X11/xorg.conf /etc/X11/XF86Config-4 \
|
---|
55 | /etc/X11/XF86Config /etc/XF86Config /usr/X11R6/etc/X11/XF86Config-4 \
|
---|
56 | /usr/X11R6/etc/X11/XF86Config /usr/X11R6/lib/X11/XF86Config-4 \
|
---|
57 | /usr/X11R6/lib/X11/XF86Config"
|
---|
58 |
|
---|
59 | # Preamble for Gentoo
|
---|
60 | if [ "`which $0`" = "/sbin/rc" ]; then
|
---|
61 | shift
|
---|
62 | fi
|
---|
63 |
|
---|
64 | dev=/dev/vboxguest
|
---|
65 | userdev=/dev/vboxuser
|
---|
66 | owner=vboxadd
|
---|
67 | group=1
|
---|
68 |
|
---|
69 | fail()
|
---|
70 | {
|
---|
71 | echo "${1}" >&2
|
---|
72 | exit 1
|
---|
73 | }
|
---|
74 |
|
---|
75 | # Install an X11 desktop startup application. The application should be a shell script.
|
---|
76 | # Its name should be purely alphanumeric and should start with a two digit number (preferably
|
---|
77 | # 98 or thereabouts) to indicate its place in the Debian Xsession startup order.
|
---|
78 | #
|
---|
79 | # syntax: install_x11_startup_app app desktop service_name
|
---|
80 | install_x11_startup_app() {
|
---|
81 | self="install_x11_startup_app"
|
---|
82 | app_src=$1
|
---|
83 | desktop_src=$2
|
---|
84 | service_name=$3
|
---|
85 | alt_command=$4
|
---|
86 | test -r "$app_src" || fail "$self: no script given"
|
---|
87 | test -r "$desktop_src" || fail "$self: no desktop file given"
|
---|
88 | test -n "$service_name" || fail "$self: no service given"
|
---|
89 | test -n "$alt_command" || fail "$self: no service given"
|
---|
90 | app_dest=`basename $app_src sh`
|
---|
91 | app_dest_sh=`basename $app_src sh`.sh
|
---|
92 | desktop_dest=`basename $desktop_src`
|
---|
93 | found=0
|
---|
94 | x11_autostart="/etc/xdg/autostart"
|
---|
95 | kde_autostart="/usr/share/autostart"
|
---|
96 | redhat_dir=/etc/X11/Xsession.d
|
---|
97 | mandriva_dir=/etc/X11/xinit.d
|
---|
98 | debian_dir=/etc/X11/xinit/xinitrc.d
|
---|
99 | if [ -d "$mandriva_dir" -a -w "$mandriva_dir" -a -x "$mandriva_dir" ]
|
---|
100 | then
|
---|
101 | install -m 0644 $app_src "$mandriva_dir/$app_dest"
|
---|
102 | found=1
|
---|
103 | fi
|
---|
104 | if [ -d "$x11_autostart" -a -w "$x11_autostart" -a -x "$x11_autostart" ]
|
---|
105 | then
|
---|
106 | install -m 0644 $desktop_src "$x11_autostart/$desktop_dest"
|
---|
107 | found=1
|
---|
108 | fi
|
---|
109 | if [ -d "$kde_autostart" -a -w "$kde_autostart" -a -x "$kde_autostart" ]
|
---|
110 | then
|
---|
111 | install -m 0644 $desktop_src "$kde_autostart/$desktop_dest"
|
---|
112 | found=1
|
---|
113 | fi
|
---|
114 | if [ -d "$redhat_dir" -a -w "$redhat_dir" -a -x "$redhat_dir" ]
|
---|
115 | then
|
---|
116 | install -m 0644 $app_src "$redhat_dir/$app_dest"
|
---|
117 | found=1
|
---|
118 | fi
|
---|
119 | if [ -d "$debian_dir" -a -w "$debian_dir" -a -x "$debian_dir" ]
|
---|
120 | then
|
---|
121 | install -m 0755 $app_src "$debian_dir/$app_dest_sh"
|
---|
122 | found=1
|
---|
123 | fi
|
---|
124 | if [ $found -eq 1 ]; then
|
---|
125 | return 0
|
---|
126 | fi
|
---|
127 | cat >&2 << EOF
|
---|
128 | Could not set up the $service_name desktop service.
|
---|
129 | To start it at log-in for a given user, add the command $alt_command
|
---|
130 | to the file .xinitrc in their home directory.
|
---|
131 | EOF
|
---|
132 | return 1
|
---|
133 | }
|
---|
134 |
|
---|
135 |
|
---|
136 | start()
|
---|
137 | {
|
---|
138 | # Todo: check configuration and correct it if necessary
|
---|
139 | return 0
|
---|
140 | }
|
---|
141 |
|
---|
142 | stop()
|
---|
143 | {
|
---|
144 | return 0
|
---|
145 | }
|
---|
146 |
|
---|
147 | restart()
|
---|
148 | {
|
---|
149 | stop && start
|
---|
150 | return 0
|
---|
151 | }
|
---|
152 |
|
---|
153 | setup()
|
---|
154 | {
|
---|
155 | if test -r "${CONFIG}"; then
|
---|
156 | . "${CONFIG}"
|
---|
157 | else
|
---|
158 | fail "Configuration file ${CONFIG} not found"
|
---|
159 | fi
|
---|
160 | test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||
|
---|
161 | fail "Configuration file ${CONFIG} not complete"
|
---|
162 | lib_dir="${INSTALL_DIR}/other"
|
---|
163 | test -x "${lib_dir}" ||
|
---|
164 | fail "Invalid Guest Additions configuration found."
|
---|
165 | # By default we want to configure X
|
---|
166 | dox11config="true"
|
---|
167 | # By default, we want to run our xorg.conf setup script
|
---|
168 | setupxorgconf="true"
|
---|
169 | # All but the oldest supported X servers can automatically set up the
|
---|
170 | # keyboard driver.
|
---|
171 | autokeyboard="--autoKeyboard"
|
---|
172 | # On more recent servers our kernel mouse driver will be used
|
---|
173 | # automatically
|
---|
174 | automouse="--autoMouse"
|
---|
175 | # We need to tell our xorg.conf hacking script whether /dev/psaux exists
|
---|
176 | nopsaux="--nopsaux"
|
---|
177 | case "`uname -r`" in 2.4.*)
|
---|
178 | test -c /dev/psaux && nopsaux="";;
|
---|
179 | esac
|
---|
180 | # Should we use the VMSVGA driver instead of VBoxVideo?
|
---|
181 | if grep 80eebeef /proc/bus/pci/devices > /dev/null; then
|
---|
182 | vmsvga=""
|
---|
183 | elif grep 15ad0405 /proc/bus/pci/devices > /dev/null; then
|
---|
184 | vmsvga="--vmsvga"
|
---|
185 | else
|
---|
186 | dox11config=""
|
---|
187 | fi
|
---|
188 | # The video driver to install for X.Org 6.9+
|
---|
189 | vboxvideo_src=
|
---|
190 | # The mouse driver to install for X.Org 6.9+
|
---|
191 | vboxmouse_src=
|
---|
192 | # The driver extension
|
---|
193 | driver_ext=".so"
|
---|
194 | # The configuration file we generate if no original was found but we need
|
---|
195 | # one.
|
---|
196 | main_cfg="/etc/X11/xorg.conf"
|
---|
197 |
|
---|
198 | modules_dir=`X -showDefaultModulePath 2>&1` || modules_dir=
|
---|
199 | if [ -z "$modules_dir" ]; then
|
---|
200 | for dir in /usr/lib64/xorg/modules /usr/lib/xorg/modules /usr/X11R6/lib64/modules /usr/X11R6/lib/modules /usr/X11R6/lib/X11/modules; do
|
---|
201 | if [ -d $dir ]; then
|
---|
202 | modules_dir=$dir
|
---|
203 | break
|
---|
204 | fi
|
---|
205 | done
|
---|
206 | fi
|
---|
207 |
|
---|
208 | case "${x_version}" in
|
---|
209 | 4.* | 6.* | 7.* | 1.?.* | 1.1[0-6].* )
|
---|
210 | blacklist_vboxvideo="yes"
|
---|
211 | ;;
|
---|
212 | esac
|
---|
213 | case "$oracle_release" in
|
---|
214 | Oracle*release\ 6.* )
|
---|
215 | # relevant for OL6/UEK4 but cannot hurt for other kernels
|
---|
216 | blacklist_vboxvideo="yes"
|
---|
217 | esac
|
---|
218 | if test -n "${blacklist_vboxvideo}"; then
|
---|
219 | test -d /etc/modprobe.d &&
|
---|
220 | echo "blacklist vboxvideo" > /etc/modprobe.d/blacklist-vboxvideo.conf
|
---|
221 | else
|
---|
222 | test -f /etc/modprobe.d/blacklist-vboxvideo.conf &&
|
---|
223 | rm -f /etc/modprobe.d/blacklist-vboxvideo.conf
|
---|
224 | # We do not want to load the driver if X.Org Server is already
|
---|
225 | # running, as without a driver the server will touch the hardware
|
---|
226 | # directly, causing problems.
|
---|
227 | ps -Af | grep -q '[X]org' || ${MODPROBE} -q vboxvideo
|
---|
228 | fi
|
---|
229 |
|
---|
230 | test -z "$x_version" -o -z "$modules_dir" &&
|
---|
231 | {
|
---|
232 | echo "Could not find the X.Org or XFree86 Window System, skipping." >&2
|
---|
233 | exit 0
|
---|
234 | }
|
---|
235 |
|
---|
236 | # openSUSE 10.3 shipped X.Org 7.2 with X.Org Server 1.3, but didn't
|
---|
237 | # advertise the fact.
|
---|
238 | if grep -q '10\.3' /etc/SuSE-release 2>/dev/null; then
|
---|
239 | case $x_version in 7.2.*)
|
---|
240 | x_version=1.3.0;;
|
---|
241 | esac
|
---|
242 | fi
|
---|
243 | case $x_version in
|
---|
244 | 1.*.99.* )
|
---|
245 | echo "Warning: unsupported pre-release version of X.Org Server installed. Not installing the X.Org drivers." >&2
|
---|
246 | dox11config=""
|
---|
247 | ;;
|
---|
248 | 1.11.* )
|
---|
249 | xserver_version="X.Org Server 1.11"
|
---|
250 | vboxvideo_src=vboxvideo_drv_111.so
|
---|
251 | test "$system" = "redhat" && test -z "${vmsvga}" || setupxorgconf=""
|
---|
252 | ;;
|
---|
253 | 1.10.* )
|
---|
254 | xserver_version="X.Org Server 1.10"
|
---|
255 | vboxvideo_src=vboxvideo_drv_110.so
|
---|
256 | test "$system" = "redhat" && test -z "${vmsvga}" || setupxorgconf=""
|
---|
257 | ;;
|
---|
258 | 1.9.* )
|
---|
259 | xserver_version="X.Org Server 1.9"
|
---|
260 | vboxvideo_src=vboxvideo_drv_19.so
|
---|
261 | # Fedora 14 to 16 patched out vboxvideo detection
|
---|
262 | test "$system" = "redhat" && test -z "${vmsvga}" || setupxorgconf=""
|
---|
263 | ;;
|
---|
264 | 1.8.* )
|
---|
265 | xserver_version="X.Org Server 1.8"
|
---|
266 | vboxvideo_src=vboxvideo_drv_18.so
|
---|
267 | # Fedora 13 shipped without vboxvideo detection
|
---|
268 | test "$system" = "redhat" && test -z "${vmsvga}" || setupxorgconf=""
|
---|
269 | ;;
|
---|
270 | 1.7.* )
|
---|
271 | xserver_version="X.Org Server 1.7"
|
---|
272 | vboxvideo_src=vboxvideo_drv_17.so
|
---|
273 | setupxorgconf=""
|
---|
274 | ;;
|
---|
275 | 1.6.* )
|
---|
276 | xserver_version="X.Org Server 1.6"
|
---|
277 | vboxvideo_src=vboxvideo_drv_16.so
|
---|
278 | vboxmouse_src=vboxmouse_drv_16.so
|
---|
279 | # SUSE SLE* with X.Org 1.6 does not do input autodetection;
|
---|
280 | # openSUSE does.
|
---|
281 | if grep -q -E '^SLE[^ ]' /etc/SuSE-brand 2>/dev/null; then
|
---|
282 | automouse=""
|
---|
283 | else
|
---|
284 | test "$system" = "suse" && setupxorgconf=""
|
---|
285 | fi
|
---|
286 | ;;
|
---|
287 | 1.5.* )
|
---|
288 | xserver_version="X.Org Server 1.5"
|
---|
289 | vboxvideo_src=vboxvideo_drv_15.so
|
---|
290 | vboxmouse_src=vboxmouse_drv_15.so
|
---|
291 | # Historical note: SUSE with X.Org Server 1.5 disabled automatic
|
---|
292 | # mouse configuration and was handled specially. However since our
|
---|
293 | # kernel driver seems to have problems with X.Org Server 1.5 anyway
|
---|
294 | # we just create an X.Org configuration file and use the user space
|
---|
295 | # one generally, no longer just for SUSE.
|
---|
296 | automouse=""
|
---|
297 | ;;
|
---|
298 | 1.4.* )
|
---|
299 | xserver_version="X.Org Server 1.4"
|
---|
300 | vboxvideo_src=vboxvideo_drv_14.so
|
---|
301 | vboxmouse_src=vboxmouse_drv_14.so
|
---|
302 | automouse=""
|
---|
303 | ;;
|
---|
304 | 1.3.* )
|
---|
305 | # This was the first release which gave the server version number
|
---|
306 | # rather than the X11 release version when you did 'X -version'.
|
---|
307 | xserver_version="X.Org Server 1.3"
|
---|
308 | vboxvideo_src=vboxvideo_drv_13.so
|
---|
309 | vboxmouse_src=vboxmouse_drv_13.so
|
---|
310 | automouse=""
|
---|
311 | ;;
|
---|
312 | 7.1.* | 7.2.* )
|
---|
313 | xserver_version="X.Org 7.1"
|
---|
314 | vboxvideo_src=vboxvideo_drv_71.so
|
---|
315 | vboxmouse_src=vboxmouse_drv_71.so
|
---|
316 | automouse=""
|
---|
317 | ;;
|
---|
318 | 6.9.* | 7.0.* )
|
---|
319 | xserver_version="X.Org 6.9/7.0"
|
---|
320 | vboxvideo_src=vboxvideo_drv_70.so
|
---|
321 | vboxmouse_src=vboxmouse_drv_70.so
|
---|
322 | automouse=""
|
---|
323 | ;;
|
---|
324 | 6.7* | 6.8.* | 4.2.* | 4.3.* )
|
---|
325 | # As the module binaries are the same we use one text for these
|
---|
326 | # four server versions.
|
---|
327 | xserver_version="XFree86 4.2/4.3 and X.Org 6.7/6.8"
|
---|
328 | driver_ext=.o
|
---|
329 | vboxvideo_src=vboxvideo_drv.o
|
---|
330 | vboxmouse_src=vboxmouse_drv.o
|
---|
331 | automouse=""
|
---|
332 | autokeyboard=""
|
---|
333 | case $x_version in
|
---|
334 | 6.8.* )
|
---|
335 | autokeyboard="true"
|
---|
336 | ;;
|
---|
337 | 4.2.* | 4.3.* )
|
---|
338 | main_cfg="/etc/X11/XF86Config"
|
---|
339 | ;;
|
---|
340 | esac
|
---|
341 | ;;
|
---|
342 | 1.12.* | 1.13.* | 1.14.* | 1.15.* | 1.16.* | 1.17.* | 1.18.* )
|
---|
343 | xserver_version="X.Org Server ${x_version_short}"
|
---|
344 | vboxvideo_src=vboxvideo_drv_`echo ${x_version_short} | sed 's/\.//'`.so
|
---|
345 | setupxorgconf=""
|
---|
346 | test -f "${lib_dir}/${vboxvideo_src}" ||
|
---|
347 | {
|
---|
348 | echo "Warning: unknown version of the X Window System installed. Not installing X Window System drivers." >&2
|
---|
349 | dox11config=""
|
---|
350 | vboxvideo_src=""
|
---|
351 | }
|
---|
352 | ;;
|
---|
353 | * )
|
---|
354 | # For anything else, assume kernel drivers.
|
---|
355 | dox11config=""
|
---|
356 | ;;
|
---|
357 | esac
|
---|
358 | test -n "${dox11config}" &&
|
---|
359 | echo "Installing $xserver_version modules" >&2
|
---|
360 | case "$vboxvideo_src" in
|
---|
361 | ?*)
|
---|
362 | ln -s "${lib_dir}/$vboxvideo_src" "$modules_dir/drivers/vboxvideo_drv$driver_ext.new" &&
|
---|
363 | mv "$modules_dir/drivers/vboxvideo_drv$driver_ext.new" "$modules_dir/drivers/vboxvideo_drv$driver_ext";;
|
---|
364 | *)
|
---|
365 | rm "$modules_dir/drivers/vboxvideo_drv$driver_ext" 2>/dev/null
|
---|
366 | esac
|
---|
367 | case "$vboxmouse_src" in
|
---|
368 | ?*)
|
---|
369 | ln -s "${lib_dir}/$vboxmouse_src" "$modules_dir/input/vboxmouse_drv$driver_ext.new" &&
|
---|
370 | mv "$modules_dir/input/vboxmouse_drv$driver_ext.new" "$modules_dir/input/vboxmouse_drv$driver_ext";;
|
---|
371 | *)
|
---|
372 | rm "$modules_dir/input/vboxmouse_drv$driver_ext" 2>/dev/null
|
---|
373 | esac
|
---|
374 |
|
---|
375 | if test -n "$dox11config"; then
|
---|
376 | # Certain Ubuntu/Debian versions use a special PCI-id file to identify
|
---|
377 | # video drivers. Some versions have the directory and don't use it.
|
---|
378 | # Those versions can autoload vboxvideo though, so we don't need to
|
---|
379 | # hack the configuration file for them.
|
---|
380 | test "$system" = "debian" -a -d /usr/share/xserver-xorg/pci &&
|
---|
381 | {
|
---|
382 | rm -f "/usr/share/xserver-xorg/pci/vboxvideo.ids"
|
---|
383 | ln -s "${lib_dir}/vboxvideo.ids" /usr/share/xserver-xorg/pci 2>/dev/null
|
---|
384 | test -n "$automouse" && setupxorgconf=""
|
---|
385 | }
|
---|
386 |
|
---|
387 | # Do the XF86Config/xorg.conf hack for those versions that require it
|
---|
388 | configured=""
|
---|
389 | generated=""
|
---|
390 | if test -n "$setupxorgconf"; then
|
---|
391 | for i in $x11conf_files; do
|
---|
392 | if test -r "$i"; then
|
---|
393 | if grep -q "VirtualBox generated" "$i"; then
|
---|
394 | generated="$generated `printf "$i\n"`"
|
---|
395 | else
|
---|
396 | "${lib_dir}/x11config.sh" $autokeyboard $automouse $nopsaux $vmsvga "$i"
|
---|
397 | fi
|
---|
398 | configured="true"
|
---|
399 | fi
|
---|
400 | # Timestamp, so that we can see if the config file is changed
|
---|
401 | # by someone else later
|
---|
402 | test -r "$i.vbox" && touch "$i.vbox"
|
---|
403 | done
|
---|
404 | # X.Org Server 1.5 and 1.6 can detect hardware they know, but they
|
---|
405 | # need a configuration file for VBoxVideo.
|
---|
406 | nobak_cfg="`expr "${main_cfg}" : '\([^.]*\)'`.vbox.nobak"
|
---|
407 | if test -z "$configured"; then
|
---|
408 | touch "$main_cfg"
|
---|
409 | "${lib_dir}/x11config.sh" $autokeyboard $automouse $nopsaux $vmsvga --noBak "$main_cfg"
|
---|
410 | touch "${nobak_cfg}"
|
---|
411 | fi
|
---|
412 | fi
|
---|
413 | test -n "$generated" &&
|
---|
414 | cat >&2 << EOF
|
---|
415 | The following X.Org/XFree86 configuration files were originally generated by
|
---|
416 | the VirtualBox Guest Additions and were not modified:
|
---|
417 |
|
---|
418 | $generated
|
---|
419 |
|
---|
420 | EOF
|
---|
421 | tty >/dev/null && cat << EOF
|
---|
422 | You may need to restart the Window System (or just restart the guest system)
|
---|
423 | to enable the Guest Additions.
|
---|
424 |
|
---|
425 | EOF
|
---|
426 | fi
|
---|
427 |
|
---|
428 | case "$redhat_release" in
|
---|
429 | # Install selinux policy for Fedora 7 and 8 to allow the X server to
|
---|
430 | # open device files
|
---|
431 | Fedora\ release\ 7* | Fedora\ release\ 8* )
|
---|
432 | semodule -i "${lib_dir}/vbox_x11.pp" > /dev/null 2>&1
|
---|
433 | ;;
|
---|
434 | # Similar for the accelerated graphics check on Fedora 15
|
---|
435 | Fedora\ release\ 15* )
|
---|
436 | semodule -i "${lib_dir}/vbox_accel.pp" > /dev/null 2>&1
|
---|
437 | ;;
|
---|
438 | esac
|
---|
439 |
|
---|
440 | # Install selinux policy for Fedora 8 to allow the X server to
|
---|
441 | # open our drivers
|
---|
442 | case "$redhat_release" in
|
---|
443 | Fedora\ release\ 8* )
|
---|
444 | chcon -u system_u -t lib_t "${lib_dir}"/*.so
|
---|
445 | ;;
|
---|
446 | esac
|
---|
447 |
|
---|
448 | # Our logging code generates some glue code on 32-bit systems. At least F10
|
---|
449 | # needs a rule to allow this. Send all output to /dev/null in case this is
|
---|
450 | # completely irrelevant on the target system.
|
---|
451 | chcon -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1
|
---|
452 | semanage fcontext -a -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1
|
---|
453 |
|
---|
454 | # And set up VBoxClient to start when the X session does
|
---|
455 | install_x11_startup_app "${lib_dir}/98vboxadd-xclient" "${lib_dir}/vboxclient.desktop" VBoxClient VBoxClient-all ||
|
---|
456 | fail "See the log file $LOG for more information."
|
---|
457 | ln -s "${lib_dir}/98vboxadd-xclient" /usr/bin/VBoxClient-all 2>/dev/null
|
---|
458 | }
|
---|
459 |
|
---|
460 | cleanup()
|
---|
461 | {
|
---|
462 | # Restore xorg.conf files as far as possible
|
---|
463 | # List of generated files which have been changed since we generated them
|
---|
464 | newer=""
|
---|
465 | # Are we dealing with a legacy information which didn't support
|
---|
466 | # uninstallation?
|
---|
467 | legacy=""
|
---|
468 | # Do any of the restored configuration files still reference our drivers?
|
---|
469 | failed=""
|
---|
470 | # Have we encountered a "nobak" configuration file which means that there
|
---|
471 | # is no original file to restore?
|
---|
472 | nobak=""
|
---|
473 | test -r "$CONFIG_DIR/$CONFIG" || legacy="true"
|
---|
474 | for main_cfg in "/etc/X11/xorg.conf" "/etc/X11/XF86Config"; do
|
---|
475 | nobak_cfg="`expr "${main_cfg}" : '\([^.]*\)'`.vbox.nobak"
|
---|
476 | if test -r "${nobak_cfg}"; then
|
---|
477 | test -r "${main_cfg}" &&
|
---|
478 | if test -n "${legacy}" -o ! "${nobak_cfg}" -ot "${main_cfg}"; then
|
---|
479 | rm -f "${nobak_cfg}" "${main_cfg}"
|
---|
480 | else
|
---|
481 | newer="${newer}`printf " ${main_cfg} (no original)\n"`"
|
---|
482 | fi
|
---|
483 | nobak="true"
|
---|
484 | fi
|
---|
485 | done
|
---|
486 | if test -z "${nobak}"; then
|
---|
487 | for i in $x11conf_files; do
|
---|
488 | if test -r "$i.vbox"; then
|
---|
489 | if test ! "$i" -nt "$i.vbox" -o -n "$legacy"; then
|
---|
490 | mv -f "$i.vbox" "$i"
|
---|
491 | grep -q -E 'vboxvideo|vboxmouse' "$i" &&
|
---|
492 | failed="$failed`printf " $i\n"`"
|
---|
493 | else
|
---|
494 | newer="$newer`printf " $i ($i.vbox)\n"`"
|
---|
495 | fi
|
---|
496 | fi
|
---|
497 | done
|
---|
498 | fi
|
---|
499 | test -n "$newer" && cat >&2 << EOF
|
---|
500 |
|
---|
501 | The following X.Org/XFree86 configuration files were not restored, as they may
|
---|
502 | have been changed since they were generated by the VirtualBox Guest Additions.
|
---|
503 | You may wish to restore these manually. The file name in brackets is the
|
---|
504 | original version.
|
---|
505 |
|
---|
506 | $newer
|
---|
507 |
|
---|
508 | EOF
|
---|
509 | test -n "$failed" && cat >&2 << EOF
|
---|
510 |
|
---|
511 | The following X.Org/XFree86 configuration files were restored, but still
|
---|
512 | contain references to the Guest Additions drivers. You may wish to check and
|
---|
513 | possibly correct the restored configuration files to be sure that the server
|
---|
514 | will continue to work after it is restarted.
|
---|
515 |
|
---|
516 | $failed
|
---|
517 |
|
---|
518 | EOF
|
---|
519 |
|
---|
520 | # Remove X.Org drivers
|
---|
521 | modules_dir=`X -showDefaultModulePath 2>&1` || modules_dir=
|
---|
522 | if [ -z "$modules_dir" ]; then
|
---|
523 | for dir in /usr/lib64/xorg/modules /usr/lib/xorg/modules /usr/X11R6/lib64/modules /usr/X11R6/lib/modules /usr/X11R6/lib/X11/modules; do
|
---|
524 | if [ -d $dir ]; then
|
---|
525 | modules_dir=$dir
|
---|
526 | break
|
---|
527 | fi
|
---|
528 | done
|
---|
529 | fi
|
---|
530 | rm -f "$modules_dir/drivers/vboxvideo_drv"* 2>/dev/null
|
---|
531 | rm -f "$modules_dir/input/vboxmouse_drv"* 2>/dev/null
|
---|
532 |
|
---|
533 | # Remove the link to vboxvideo_dri.so
|
---|
534 | for dir in /usr/lib/dri /usr/lib32/dri /usr/lib64/dri \
|
---|
535 | /usr/lib/xorg/modules/dri /usr/lib32/xorg/modules/dri \
|
---|
536 | /usr/lib64/xorg/modules/dri /usr/lib/i386-linux-gnu/dri \
|
---|
537 | /usr/lib/x86_64-linux-gnu/dri; do
|
---|
538 | if [ -d $dir ]; then
|
---|
539 | rm -f "$dir/vboxvideo_dri.so" 2>/dev/null
|
---|
540 | fi
|
---|
541 | done
|
---|
542 |
|
---|
543 | # Remove VBoxClient autostart files
|
---|
544 | rm /etc/X11/Xsession.d/98vboxadd-xclient 2>/dev/null
|
---|
545 | rm /etc/X11/xinit.d/98vboxadd-xclient 2>/dev/null
|
---|
546 | rm /etc/X11/xinit/xinitrc.d/98vboxadd-xclient.sh 2>/dev/null
|
---|
547 | rm /etc/xdg/autostart/vboxclient.desktop 2>/dev/null
|
---|
548 | rm /usr/share/autostart/vboxclient.desktop 2>/dev/null
|
---|
549 | rm /usr/bin/VBoxClient-all 2>/dev/null
|
---|
550 |
|
---|
551 | # Remove other files
|
---|
552 | rm /usr/share/xserver-xorg/pci/vboxvideo.ids 2>/dev/null
|
---|
553 | }
|
---|
554 |
|
---|
555 | dmnstatus()
|
---|
556 | {
|
---|
557 | /bin/true
|
---|
558 | }
|
---|
559 |
|
---|
560 | case "$1" in
|
---|
561 | start)
|
---|
562 | start
|
---|
563 | ;;
|
---|
564 | stop)
|
---|
565 | stop
|
---|
566 | ;;
|
---|
567 | restart)
|
---|
568 | restart
|
---|
569 | ;;
|
---|
570 | setup)
|
---|
571 | setup
|
---|
572 | ;;
|
---|
573 | cleanup)
|
---|
574 | cleanup
|
---|
575 | ;;
|
---|
576 | status)
|
---|
577 | dmnstatus
|
---|
578 | ;;
|
---|
579 | *)
|
---|
580 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
581 | exit 1
|
---|
582 | esac
|
---|
583 |
|
---|
584 | exit
|
---|