1 | #! /bin/sh
|
---|
2 | # Sun VirtualBox
|
---|
3 | # Linux Additions X11 setup init script ($Revision: 24410 $)
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
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 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | # additional information or have any questions.
|
---|
20 | #
|
---|
21 |
|
---|
22 |
|
---|
23 | # chkconfig: 35 30 70
|
---|
24 | # description: VirtualBox Linux Additions kernel modules
|
---|
25 | #
|
---|
26 | ### BEGIN INIT INFO
|
---|
27 | # Provides: vboxadd-x11
|
---|
28 | # Required-Start:
|
---|
29 | # Required-Stop:
|
---|
30 | # Default-Start:
|
---|
31 | # Default-Stop:
|
---|
32 | # Description: VirtualBox Linux Additions X11 setup
|
---|
33 | ### END INIT INFO
|
---|
34 |
|
---|
35 | PATH=$PATH:/bin:/sbin:/usr/sbin
|
---|
36 | LOG="/var/log/vboxadd-install-x11.log"
|
---|
37 |
|
---|
38 | # Find the version of X installed
|
---|
39 | # The last of the three is for the X.org 6.7 included in Fedora Core 2
|
---|
40 | xver=`X -version 2>&1`
|
---|
41 | 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'`
|
---|
42 | # Version of Redhat or Fedora installed. Needed for setting up selinux policy.
|
---|
43 | redhat_release=`cat /etc/redhat-release 2> /dev/null`
|
---|
44 | # All the different possible locations for XFree86/X.Org configuration files
|
---|
45 | # - how many of these have ever been used?
|
---|
46 | x11conf_files="/etc/X11/xorg.conf /etc/X11/xorg.conf-4 /etc/X11/.xorg.conf \
|
---|
47 | /etc/xorg.conf /usr/etc/X11/xorg.conf-4 /usr/etc/X11/xorg.conf \
|
---|
48 | /usr/lib/X11/xorg.conf-4 /usr/lib/X11/xorg.conf /etc/X11/XF86Config-4 \
|
---|
49 | /etc/X11/XF86Config /etc/XF86Config /usr/X11R6/etc/X11/XF86Config-4 \
|
---|
50 | /usr/X11R6/etc/X11/XF86Config /usr/X11R6/lib/X11/XF86Config-4 \
|
---|
51 | /usr/X11R6/lib/X11/XF86Config"
|
---|
52 |
|
---|
53 | if [ -f /etc/arch-release ]; then
|
---|
54 | system=arch
|
---|
55 | elif [ -f /etc/redhat-release ]; then
|
---|
56 | system=redhat
|
---|
57 | elif [ -f /etc/SuSE-release ]; then
|
---|
58 | system=suse
|
---|
59 | elif [ -f /etc/gentoo-release ]; then
|
---|
60 | system=gentoo
|
---|
61 | elif [ -f /etc/lfs-release -a -d /etc/rc.d/init.d ]; then
|
---|
62 | system=lfs
|
---|
63 | else
|
---|
64 | system=other
|
---|
65 | fi
|
---|
66 |
|
---|
67 | if [ "$system" = "arch" ]; then
|
---|
68 | USECOLOR=yes
|
---|
69 | . /etc/rc.d/functions
|
---|
70 | fail_msg() {
|
---|
71 | stat_fail
|
---|
72 | }
|
---|
73 |
|
---|
74 | succ_msg() {
|
---|
75 | stat_done
|
---|
76 | }
|
---|
77 |
|
---|
78 | begin() {
|
---|
79 | stat_busy "$1"
|
---|
80 | }
|
---|
81 | fi
|
---|
82 |
|
---|
83 | if [ "$system" = "redhat" ]; then
|
---|
84 | . /etc/init.d/functions
|
---|
85 | fail_msg() {
|
---|
86 | echo_failure
|
---|
87 | echo
|
---|
88 | }
|
---|
89 | succ_msg() {
|
---|
90 | echo_success
|
---|
91 | echo
|
---|
92 | }
|
---|
93 | begin() {
|
---|
94 | echo -n "$1"
|
---|
95 | }
|
---|
96 | fi
|
---|
97 |
|
---|
98 | if [ "$system" = "suse" ]; then
|
---|
99 | . /etc/rc.status
|
---|
100 | fail_msg() {
|
---|
101 | rc_failed 1
|
---|
102 | rc_status -v
|
---|
103 | }
|
---|
104 | succ_msg() {
|
---|
105 | rc_reset
|
---|
106 | rc_status -v
|
---|
107 | }
|
---|
108 | begin() {
|
---|
109 | echo -n "$1"
|
---|
110 | }
|
---|
111 | fi
|
---|
112 |
|
---|
113 | if [ "$system" = "gentoo" ]; then
|
---|
114 | if [ -f /sbin/functions.sh ]; then
|
---|
115 | . /sbin/functions.sh
|
---|
116 | elif [ -f /etc/init.d/functions.sh ]; then
|
---|
117 | . /etc/init.d/functions.sh
|
---|
118 | fi
|
---|
119 | fail_msg() {
|
---|
120 | eend 1
|
---|
121 | }
|
---|
122 | succ_msg() {
|
---|
123 | eend $?
|
---|
124 | }
|
---|
125 | begin() {
|
---|
126 | ebegin $1
|
---|
127 | }
|
---|
128 | if [ "`which $0`" = "/sbin/rc" ]; then
|
---|
129 | shift
|
---|
130 | fi
|
---|
131 | fi
|
---|
132 |
|
---|
133 | if [ "$system" = "lfs" ]; then
|
---|
134 | . /etc/rc.d/init.d/functions
|
---|
135 | fail_msg() {
|
---|
136 | echo_failure
|
---|
137 | }
|
---|
138 | succ_msg() {
|
---|
139 | echo_ok
|
---|
140 | }
|
---|
141 | begin() {
|
---|
142 | echo $1
|
---|
143 | }
|
---|
144 | fi
|
---|
145 |
|
---|
146 | if [ "$system" = "other" ]; then
|
---|
147 | fail_msg() {
|
---|
148 | echo " ...fail!"
|
---|
149 | }
|
---|
150 | succ_msg() {
|
---|
151 | echo " ...done."
|
---|
152 | }
|
---|
153 | begin() {
|
---|
154 | echo -n $1
|
---|
155 | }
|
---|
156 | fi
|
---|
157 |
|
---|
158 | dev=/dev/vboxguest
|
---|
159 | userdev=/dev/vboxuser
|
---|
160 | owner=vboxadd
|
---|
161 | group=1
|
---|
162 |
|
---|
163 | fail()
|
---|
164 | {
|
---|
165 | if [ "$system" = "gentoo" ]; then
|
---|
166 | eerror $1
|
---|
167 | exit 1
|
---|
168 | fi
|
---|
169 | fail_msg
|
---|
170 | echo "($1)"
|
---|
171 | exit 1
|
---|
172 | }
|
---|
173 |
|
---|
174 | # Install an X11 desktop startup application. The application should be a shell script.
|
---|
175 | # Its name should be purely alphanumeric and should start with a two digit number (preferably
|
---|
176 | # 98 or thereabouts) to indicate its place in the Debian Xsession startup order.
|
---|
177 | #
|
---|
178 | # syntax: install_x11_startup_app app desktop service_name
|
---|
179 | install_x11_startup_app() {
|
---|
180 | app_src=$1
|
---|
181 | desktop_src=$2
|
---|
182 | service_name=$3
|
---|
183 | alt_command=$4
|
---|
184 | test -r "$app_src" ||
|
---|
185 | { echo "install_x11_startup_app: no script given"; return 1; }
|
---|
186 | test -r "$desktop_src" ||
|
---|
187 | { echo "install_x11_startup_app: no desktop file given"; return 1; }
|
---|
188 | test -n "$service_name" ||
|
---|
189 | { echo "install_x11_startup_app: no service given"; return 1; }
|
---|
190 | test -n "$alt_command" ||
|
---|
191 | { echo "install_x11_startup_app: no service given"; return 1; }
|
---|
192 | app_dest=`basename $app_src sh`
|
---|
193 | app_dest_sh=`basename $app_src sh`.sh
|
---|
194 | desktop_dest=`basename $desktop_src`
|
---|
195 | found=0
|
---|
196 | x11_autostart="/etc/xdg/autostart"
|
---|
197 | kde_autostart="/usr/share/autostart"
|
---|
198 | redhat_dir=/etc/X11/Xsession.d
|
---|
199 | mandriva_dir=/etc/X11/xinit.d
|
---|
200 | debian_dir=/etc/X11/xinit/xinitrc.d
|
---|
201 | if [ -d "$mandriva_dir" -a -w "$mandriva_dir" -a -x "$mandriva_dir" ]
|
---|
202 | then
|
---|
203 | install -m 0644 $app_src "$mandriva_dir/$app_dest"
|
---|
204 | found=1
|
---|
205 | fi
|
---|
206 | if [ -d "$x11_autostart" -a -w "$x11_autostart" -a -x "$x11_autostart" ]
|
---|
207 | then
|
---|
208 | install -m 0644 $desktop_src "$x11_autostart/$desktop_dest"
|
---|
209 | found=1
|
---|
210 | fi
|
---|
211 | if [ -d "$kde_autostart" -a -w "$kde_autostart" -a -x "$kde_autostart" ]
|
---|
212 | then
|
---|
213 | install -m 0644 $desktop_src "$kde_autostart/$desktop_dest"
|
---|
214 | found=1
|
---|
215 | fi
|
---|
216 | if [ -d "$redhat_dir" -a -w "$redhat_dir" -a -x "$redhat_dir" ]
|
---|
217 | then
|
---|
218 | install -m 0644 $app_src "$redhat_dir/$app_dest"
|
---|
219 | found=1
|
---|
220 | fi
|
---|
221 | if [ -d "$debian_dir" -a -w "$debian_dir" -a -x "$debian_dir" ]
|
---|
222 | then
|
---|
223 | install -m 0755 $app_src "$debian_dir/$app_dest_sh"
|
---|
224 | found=1
|
---|
225 | fi
|
---|
226 | if [ $found -eq 1 ]; then
|
---|
227 | return 0
|
---|
228 | fi
|
---|
229 | cat << EOF
|
---|
230 | Could not set up the X Window $service_name service.
|
---|
231 | To start the $service_name service at log-in for a given user,
|
---|
232 | add the command $alt_command to the file .xinitrc in their home
|
---|
233 | directory.
|
---|
234 | EOF
|
---|
235 | return 1
|
---|
236 | }
|
---|
237 |
|
---|
238 |
|
---|
239 | start()
|
---|
240 | {
|
---|
241 | # Todo: check configuration and correct it if necessary
|
---|
242 | return 0
|
---|
243 | }
|
---|
244 |
|
---|
245 | stop()
|
---|
246 | {
|
---|
247 | return 0
|
---|
248 | }
|
---|
249 |
|
---|
250 | restart()
|
---|
251 | {
|
---|
252 | stop && start
|
---|
253 | return 0
|
---|
254 | }
|
---|
255 |
|
---|
256 | # setup_script
|
---|
257 | setup()
|
---|
258 | {
|
---|
259 | begin "Setting up the X Window System drivers"
|
---|
260 | lib_dir="/usr/lib/VBoxGuestAdditions"
|
---|
261 | share_dir="/usr/share/VBoxGuestAdditions"
|
---|
262 | test -x "$lib_dir" -a -x "$share_dir" ||
|
---|
263 | fail "Invalid Guest Additions configuration found"
|
---|
264 | # By default, we want to run our X Window System configuration script
|
---|
265 | dox11config=1
|
---|
266 | # But not the special version for X.Org 1.5+
|
---|
267 | dox11config15=0
|
---|
268 | # And we don't install our SUSE/X.Org 1.5 configuration file by default
|
---|
269 | dox11config15suse=0
|
---|
270 | # We want to use hal for auto-loading the mouse driver
|
---|
271 | useHalForMouse=1
|
---|
272 | # And on newer servers, we want to test whether dynamic resizing will work
|
---|
273 | testRandR=1
|
---|
274 | # The video driver to install for X.Org 6.9+
|
---|
275 | vboxvideo_src=
|
---|
276 | # The mouse driver to install for X.Org 6.9+
|
---|
277 | vboxmouse_src=
|
---|
278 |
|
---|
279 | modules_dir=`X -showDefaultModulePath 2>&1` || modules_dir=
|
---|
280 | if [ -z "$modules_dir" ]; then
|
---|
281 | 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
|
---|
282 | if [ -d $dir ]; then
|
---|
283 | modules_dir=$dir
|
---|
284 | break
|
---|
285 | fi
|
---|
286 | done
|
---|
287 | fi
|
---|
288 |
|
---|
289 | test -z "$x_version" -o -z "$modules_dir" &&
|
---|
290 | fail "Could not find X.org or XFree86 on the guest system. The X Window drivers \
|
---|
291 | will not be installed."
|
---|
292 |
|
---|
293 | echo
|
---|
294 | case $x_version in
|
---|
295 | 1.7.99.* )
|
---|
296 | echo "Warning: unsupported pre-release version of X.Org Server installed. Not"
|
---|
297 | echo "installing the X.Org drivers."
|
---|
298 | dox11config=0
|
---|
299 | ;;
|
---|
300 | 1.6.99.* | 1.7.* )
|
---|
301 | begin "Installing experimental Xorg Server 1.7 modules"
|
---|
302 | vboxvideo_src=vboxvideo_drv_17.so
|
---|
303 | vboxmouse_src=vboxmouse_drv_17.so
|
---|
304 | dox11config=0
|
---|
305 | ;;
|
---|
306 | 1.5.99.* | 1.6.* )
|
---|
307 | begin "Installing Xorg Server 1.6 modules"
|
---|
308 | vboxvideo_src=vboxvideo_drv_16.so
|
---|
309 | vboxmouse_src=vboxmouse_drv_16.so
|
---|
310 | dox11config=0
|
---|
311 | ;;
|
---|
312 | 1.4.99.* | 1.5.* )
|
---|
313 | # Fedora 9 shipped X.Org Server version 1.4.99.9x (1.5.0 RC)
|
---|
314 | # in its released version
|
---|
315 | begin "Installing Xorg Server 1.5 modules"
|
---|
316 | vboxvideo_src=vboxvideo_drv_15.so
|
---|
317 | vboxmouse_src=vboxmouse_drv_15.so
|
---|
318 | # SUSE with X.Org 1.5 is a special case, and is handled specially
|
---|
319 | if [ -f /etc/SuSE-release ]
|
---|
320 | then
|
---|
321 | dox11config15suse=1
|
---|
322 | else
|
---|
323 | # This means do a limited configuration for systems with
|
---|
324 | # autodetection support
|
---|
325 | dox11config15=1
|
---|
326 | fi
|
---|
327 | ;;
|
---|
328 | 1.4.* )
|
---|
329 | begin "Installing Xorg Server 1.4 modules"
|
---|
330 | vboxvideo_src=vboxvideo_drv_14.so
|
---|
331 | vboxmouse_src=vboxmouse_drv_14.so
|
---|
332 | useHalForMouse=0
|
---|
333 | ;;
|
---|
334 | 1.3.* )
|
---|
335 | # This was the first release which gave the server version number
|
---|
336 | # rather than the X11 release version when you did 'X -version'.
|
---|
337 | begin "Installing Xorg Server 1.3 modules"
|
---|
338 | vboxvideo_src=vboxvideo_drv_13.so
|
---|
339 | vboxmouse_src=vboxmouse_drv_71.so
|
---|
340 | useHalForMouse=0
|
---|
341 | ;;
|
---|
342 | 7.1.* | 7.2.* )
|
---|
343 | begin "Installing Xorg 7.1 modules"
|
---|
344 | vboxvideo_src=vboxvideo_drv_71.so
|
---|
345 | vboxmouse_src=vboxmouse_drv_71.so
|
---|
346 | useHalForMouse=0
|
---|
347 | testRandR=0
|
---|
348 | ;;
|
---|
349 | 6.9.* | 7.0.* )
|
---|
350 | begin "Installing Xorg 6.9/7.0 modules"
|
---|
351 | vboxvideo_src=vboxvideo_drv_70.so
|
---|
352 | vboxmouse_src=vboxmouse_drv_70.so
|
---|
353 | useHalForMouse=0
|
---|
354 | testRandR=0
|
---|
355 | ;;
|
---|
356 | 6.7* | 6.8.* | 4.2.* | 4.3.* )
|
---|
357 | # Assume X.Org post-fork or XFree86
|
---|
358 | begin "Installing XFree86 4.3/Xorg 6.8 modules"
|
---|
359 | ln -s "$lib_dir/vboxvideo_drv.o" "$modules_dir/drivers/vboxvideo_drv.o"
|
---|
360 | ln -s "$lib_dir/vboxmouse_drv.o" "$modules_dir/input/vboxmouse_drv.o"
|
---|
361 | useHalForMouse=0
|
---|
362 | testRandR=0
|
---|
363 | ;;
|
---|
364 | * )
|
---|
365 | echo "Warning: unknown version of the X Window System installed. Not installing"
|
---|
366 | echo "X Window System drivers."
|
---|
367 | dox11config=0
|
---|
368 | useHalForMouse=0
|
---|
369 | ;;
|
---|
370 | esac
|
---|
371 | if [ -n "$vboxvideo_src" -a -n "$vboxmouse_src" ]; then
|
---|
372 | rm "$modules_dir/drivers/vboxvideo_drv.so" 2>/dev/null
|
---|
373 | rm "$modules_dir/input/vboxmouse_drv.so" 2>/dev/null
|
---|
374 | ln -s "$lib_dir/$vboxvideo_src" "$modules_dir/drivers/vboxvideo_drv.so"
|
---|
375 | ln -s "$lib_dir/$vboxmouse_src" "$modules_dir/input/vboxmouse_drv.so" &&
|
---|
376 | succ_msg
|
---|
377 | fi
|
---|
378 | if [ $testRandR -eq 1 ]; then
|
---|
379 | # Run VBoxRandR in test mode as it prints out useful information if
|
---|
380 | # dynamic resizing can't be used. Don't fail here though.
|
---|
381 | /usr/bin/VBoxRandR --test 1>&2
|
---|
382 | else
|
---|
383 | echo "You appear to be have an old version of the X Window system installed on"
|
---|
384 | echo "your guest system. Seamless mode and dynamic resizing will not work in"
|
---|
385 | echo "this guest."
|
---|
386 | fi
|
---|
387 | # Install selinux policy for Fedora 7 and 8 to allow the X server to open device files
|
---|
388 | case "$redhat_release" in
|
---|
389 | Fedora\ release\ 7* | Fedora\ release\ 8* )
|
---|
390 | semodule -i vbox_x11.pp > /dev/null 2>&1
|
---|
391 | ;;
|
---|
392 | esac
|
---|
393 |
|
---|
394 | # Our logging code generates some glue code on 32-bit systems. At least F10
|
---|
395 | # needs a rule to allow this. Send all output to /dev/null in case this is
|
---|
396 | # completely irrelevant on the target system.
|
---|
397 | chcon -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1
|
---|
398 | semanage fcontext -a -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1
|
---|
399 |
|
---|
400 | # Do the XF86Config/xorg.conf hack for those versions that require it
|
---|
401 | if [ $dox11config -eq 1 ]
|
---|
402 | then
|
---|
403 | # Backup any xorg.conf files
|
---|
404 | for i in $x11conf_files; do
|
---|
405 | test -r "$i" -a ! -f "`dirname $i`/xorg.vbox.nobak" &&
|
---|
406 | cp "$i" "$i.vbox"
|
---|
407 | done
|
---|
408 | if [ $dox11config15suse -eq 1 ]
|
---|
409 | then
|
---|
410 | cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak 2> /dev/null
|
---|
411 | cp "$lib_dir/linux_xorg_suse11.conf" /etc/X11/xorg.conf 2> /dev/null
|
---|
412 | elif [ $dox11config15 -eq 1 ]
|
---|
413 | then
|
---|
414 | "$lib_dir/x11config15.pl" >> $LOG 2>&1
|
---|
415 | x11configured=0
|
---|
416 | for x11configdir in /etc/X11 /etc /usr/etc/X11 /usr/lib/X11
|
---|
417 | do
|
---|
418 | if [ -e $x11configdir/xorg.conf -o -e $x11configdir/xorg.conf-4 ]
|
---|
419 | then
|
---|
420 | x11configured=1
|
---|
421 | fi
|
---|
422 | if [ $x11configured -eq 0 ]
|
---|
423 | then
|
---|
424 | cat > /etc/X11/xorg.conf << EOF
|
---|
425 | # Default xorg.conf for Xorg 1.5+ without PCI_TXT_IDS_PATH enabled.
|
---|
426 | #
|
---|
427 | # This file was created by VirtualBox Additions installer as it
|
---|
428 | # was unable to find any existing configuration file for X.
|
---|
429 |
|
---|
430 | Section "Device"
|
---|
431 | Identifier "VirtualBox Video Card"
|
---|
432 | Driver "vboxvideo"
|
---|
433 | EndSection
|
---|
434 | EOF
|
---|
435 | touch /etc/X11/xorg.vbox.nobak
|
---|
436 | fi
|
---|
437 | done
|
---|
438 | else
|
---|
439 | "$lib_dir/x11config.pl" >> $LOG 2>&1
|
---|
440 | fi
|
---|
441 | fi
|
---|
442 |
|
---|
443 | # Certain Ubuntu/Debian versions use a special PCI-id file to identify
|
---|
444 | # video drivers
|
---|
445 | if [ -f /etc/debian_version ]
|
---|
446 | then
|
---|
447 | if [ -d /usr/share/xserver-xorg/pci ]
|
---|
448 | then
|
---|
449 | ln -s "$lib_dir/vboxvideo.ids" /usr/share/xserver-xorg/pci 2>/dev/null
|
---|
450 | fi
|
---|
451 | fi
|
---|
452 |
|
---|
453 | # And X.Org Server versions starting with 1.5 can do mouse auto-detection,
|
---|
454 | # to make our lives easier and spare us the nasty hacks.
|
---|
455 | if [ $useHalForMouse -eq 1 ]
|
---|
456 | then
|
---|
457 | # Install hal information about the mouse driver so that X.Org
|
---|
458 | # knows to load it.
|
---|
459 | if [ -d /etc/hal/fdi/policy ]
|
---|
460 | then
|
---|
461 | install -o 0 -g 0 -m 0644 "$share_dir/90-vboxguest.fdi" /etc/hal/fdi/policy
|
---|
462 | # Delete the hal cache so that it notices our fdi file
|
---|
463 | rm -r /var/cache/hald/fdi-cache 2> /dev/null
|
---|
464 | fi
|
---|
465 | fi
|
---|
466 | # Install the guest OpenGL drivers
|
---|
467 | if [ "$ARCH" = "amd64" ]
|
---|
468 | then
|
---|
469 | LIB=/usr/lib64
|
---|
470 | else
|
---|
471 | LIB=/usr/lib
|
---|
472 | fi
|
---|
473 | if [ -d /usr/lib64/dri ]
|
---|
474 | then
|
---|
475 | rm -f /usr/lib64/dri/vboxvideo_dri.so
|
---|
476 | ln -s $LIB/VBoxOGL.so /usr/lib64/dri/vboxvideo_dri.so
|
---|
477 | elif [ -d /usr/lib/dri ]
|
---|
478 | then
|
---|
479 | rm -f /usr/lib/dri/vboxvideo_dri.so
|
---|
480 | ln -s $LIB/VBoxOGL.so /usr/lib/dri/vboxvideo_dri.so
|
---|
481 | fi
|
---|
482 |
|
---|
483 | # And set up VBoxClient to start when the X session does
|
---|
484 | install_x11_startup_app "$lib_dir/98vboxadd-xclient" "$share_dir/vboxclient.desktop" VBoxClient VBoxClient-all
|
---|
485 | }
|
---|
486 |
|
---|
487 | # cleanup_script
|
---|
488 | cleanup()
|
---|
489 | {
|
---|
490 | # Restore xorg.conf files as far as possible
|
---|
491 | for i in $x11conf_files; do
|
---|
492 | restored=0
|
---|
493 | if test -f "`dirname $i`/xorg.vbox.nobak"; then
|
---|
494 | rm -f "$i" 2> /dev/null
|
---|
495 | restored=1
|
---|
496 | elif test -r "$i.vbox"; then
|
---|
497 | if ! grep -q -E "vboxvideo|vboxmouse" "$i.vbox"; then
|
---|
498 | mv -f "$i.vbox" "$i"
|
---|
499 | restored=1
|
---|
500 | fi
|
---|
501 | elif test -r "$i.bak"; then
|
---|
502 | if ! grep -q -E "vboxvideo|vboxmouse" "$i.bak"; then
|
---|
503 | mv -f "$i.bak" "$i"
|
---|
504 | restored=1
|
---|
505 | fi
|
---|
506 | elif ! test -f "$i"; then
|
---|
507 | restored=1
|
---|
508 | fi
|
---|
509 | test "$restored" = 1 &&
|
---|
510 | rm -f "`dirname $i`/xorg.vbox.nobak" "$i.vbox" 2> /dev/null
|
---|
511 | test "$restored" = 0 && cat << EOF
|
---|
512 | Failed to restore the X server configuration file $i.
|
---|
513 | Please make sure that you reconfigure your X server before it is started
|
---|
514 | again, as otherwise it may fail to start!
|
---|
515 | EOF
|
---|
516 | done
|
---|
517 |
|
---|
518 | # Remove X.Org drivers
|
---|
519 | find "$x11_modules_dir" /usr/lib64/xorg/modules /usr/lib/xorg/modules \
|
---|
520 | /usr/X11R6/lib64/modules /usr/X11R6/lib/modules \
|
---|
521 | /usr/X11R6/lib/X11/modules \
|
---|
522 | '(' -name 'vboxvideo_drv*' -o -name 'vboxmouse_drv*' ')' \
|
---|
523 | -exec rm -f '{}' ';' 2>/dev/null
|
---|
524 |
|
---|
525 | # Remove the link to vboxvideo_dri.so
|
---|
526 | rm -f /usr/lib/dri/vboxvideo_dri.so /usr/lib64/dri/vboxvideo_dri.so 2>/dev/null
|
---|
527 |
|
---|
528 | # Remove VBoxClient autostart files
|
---|
529 | rm /etc/X11/Xsession.d/98vboxadd-xclient 2>/dev/null
|
---|
530 | rm /etc/X11/xinit.d/98vboxadd-xclient 2>/dev/null
|
---|
531 | rm /etc/X11/xinit/xinitrc.d/98vboxadd-xclient.sh 2>/dev/null
|
---|
532 | rm /etc/xdg/autostart/vboxclient.desktop 2>/dev/null
|
---|
533 | rm /usr/share/autostart/vboxclient.desktop 2>/dev/null
|
---|
534 |
|
---|
535 | # Remove other files
|
---|
536 | rm /etc/hal/fdi/policy/90-vboxguest.fdi 2>/dev/null
|
---|
537 | rm /usr/share/xserver-xorg/pci/vboxvideo.ids 2>/dev/null
|
---|
538 | }
|
---|
539 |
|
---|
540 | dmnstatus()
|
---|
541 | {
|
---|
542 | if running_vboxguest; then
|
---|
543 | echo "The VirtualBox Additions are currently running."
|
---|
544 | else
|
---|
545 | echo "The VirtualBox Additions are not currently running."
|
---|
546 | fi
|
---|
547 | }
|
---|
548 |
|
---|
549 | case "$1" in
|
---|
550 | start)
|
---|
551 | start
|
---|
552 | ;;
|
---|
553 | stop)
|
---|
554 | stop
|
---|
555 | ;;
|
---|
556 | restart)
|
---|
557 | restart
|
---|
558 | ;;
|
---|
559 | setup)
|
---|
560 | setup
|
---|
561 | ;;
|
---|
562 | cleanup)
|
---|
563 | cleanup
|
---|
564 | ;;
|
---|
565 | status)
|
---|
566 | dmnstatus
|
---|
567 | ;;
|
---|
568 | *)
|
---|
569 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
570 | exit 1
|
---|
571 | esac
|
---|
572 |
|
---|
573 | exit
|
---|