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