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