1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Oracle VM VirtualBox
|
---|
4 | # VirtualBox linux installation script
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2007-2010 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 | PATH=$PATH:/bin:/sbin:/usr/sbin
|
---|
19 |
|
---|
20 | # Source functions needed by the installer
|
---|
21 | . ./routines.sh
|
---|
22 |
|
---|
23 | LOG="/var/log/vbox-install.log"
|
---|
24 | VERSION="_VERSION_"
|
---|
25 | SVNREV="_SVNREV_"
|
---|
26 | BUILD="_BUILD_"
|
---|
27 | ARCH="_ARCH_"
|
---|
28 | HARDENED="_HARDENED_"
|
---|
29 | CONFIG_DIR="/etc/vbox"
|
---|
30 | CONFIG="vbox.cfg"
|
---|
31 | CONFIG_FILES="filelist"
|
---|
32 | DEFAULT_FILES=`pwd`/deffiles
|
---|
33 | GROUPNAME="vboxusers"
|
---|
34 | INSTALLATION_DIR="/opt/VirtualBox"
|
---|
35 | LICENSE_ACCEPTED=""
|
---|
36 | PREV_INSTALLATION=""
|
---|
37 | PYTHON="_PYTHON_"
|
---|
38 | ACTION=""
|
---|
39 | SELF=$1
|
---|
40 | DKMS=`which dkms 2> /dev/null`
|
---|
41 | RC_SCRIPT=0
|
---|
42 | if [ -n "$HARDENED" ]; then
|
---|
43 | VBOXDRV_MODE=0600
|
---|
44 | VBOXDRV_GRP="root"
|
---|
45 | else
|
---|
46 | VBOXDRV_MODE=0660
|
---|
47 | VBOXDRV_GRP=$GROUPNAME
|
---|
48 | fi
|
---|
49 | VBOXUSB_MODE=0664
|
---|
50 | VBOXUSB_GRP=$GROUPNAME
|
---|
51 |
|
---|
52 |
|
---|
53 | ##############################################################################
|
---|
54 | # Helper routines #
|
---|
55 | ##############################################################################
|
---|
56 |
|
---|
57 | usage() {
|
---|
58 | info ""
|
---|
59 | info "Usage: install [<installation directory>] | uninstall"
|
---|
60 | info ""
|
---|
61 | info "Example:"
|
---|
62 | info "$SELF install"
|
---|
63 | exit 1
|
---|
64 | }
|
---|
65 |
|
---|
66 | module_loaded() {
|
---|
67 | lsmod | grep -q vboxdrv
|
---|
68 | }
|
---|
69 |
|
---|
70 | # This routine makes sure that there is no previous installation of
|
---|
71 | # VirtualBox other than one installed using this install script or a
|
---|
72 | # compatible method. We do this by checking for any of the VirtualBox
|
---|
73 | # applications in /usr/bin. If these exist and are not symlinks into
|
---|
74 | # the installation directory, then we assume that they are from an
|
---|
75 | # incompatible previous installation.
|
---|
76 |
|
---|
77 | ## Helper routine: test for a particular VirtualBox binary and see if it
|
---|
78 | ## is a link into a previous installation directory
|
---|
79 | ##
|
---|
80 | ## Arguments: 1) the binary to search for and
|
---|
81 | ## 2) the installation directory (if any)
|
---|
82 | ## Returns: false if an incompatible version was detected, true otherwise
|
---|
83 | check_binary() {
|
---|
84 | binary=$1
|
---|
85 | install_dir=$2
|
---|
86 | test ! -e $binary 2>&1 > /dev/null ||
|
---|
87 | ( test -n "$install_dir" &&
|
---|
88 | readlink $binary 2>/dev/null | grep "$install_dir" > /dev/null
|
---|
89 | )
|
---|
90 | }
|
---|
91 |
|
---|
92 | ## Main routine
|
---|
93 | ##
|
---|
94 | ## Argument: the directory where the previous installation should be
|
---|
95 | ## located. If this is empty, then we will assume that any
|
---|
96 | ## installation of VirtualBox found is incompatible with this one.
|
---|
97 | ## Returns: false if an incompatible installation was found, true otherwise
|
---|
98 | check_previous() {
|
---|
99 | install_dir=$1
|
---|
100 | # These should all be symlinks into the installation folder
|
---|
101 | check_binary "/usr/bin/VirtualBox" "$install_dir" &&
|
---|
102 | check_binary "/usr/bin/VBoxManage" "$install_dir" &&
|
---|
103 | check_binary "/usr/bin/VBoxSDL" "$install_dir" &&
|
---|
104 | check_binary "/usr/bin/VBoxVRDP" "$install_dir" &&
|
---|
105 | check_binary "/usr/bin/VBoxHeadless" "$install_dir" &&
|
---|
106 | check_binary "/usr/bin/vboxwebsrv" "$install_dir"
|
---|
107 | }
|
---|
108 |
|
---|
109 | ##############################################################################
|
---|
110 | # Main script #
|
---|
111 | ##############################################################################
|
---|
112 |
|
---|
113 | info "VirtualBox Version $VERSION r$SVNREV ($BUILD) installer"
|
---|
114 |
|
---|
115 | check_root # Make sure that we were invoked as root...
|
---|
116 | check_running # ... and that no copy of VirtualBox was running at the time.
|
---|
117 |
|
---|
118 | # Set up logging before anything else
|
---|
119 | create_log $LOG
|
---|
120 | log "VirtualBox $VERSION r$SVNREV installer, built $BUILD."
|
---|
121 | log ""
|
---|
122 | log "Testing system setup..."
|
---|
123 |
|
---|
124 | # Sanity check: figure out whether build arch matches uname arch
|
---|
125 | cpu=`uname -m`;
|
---|
126 | case "$cpu" in
|
---|
127 | i[3456789]86|x86)
|
---|
128 | cpu="x86"
|
---|
129 | ;;
|
---|
130 | x86_64)
|
---|
131 | cpu="amd64"
|
---|
132 | ;;
|
---|
133 | esac
|
---|
134 | if [ "$cpu" != "$ARCH" ]; then
|
---|
135 | info "Detected unsupported $cpu environment."
|
---|
136 | log "Detected unsupported $cpu environment."
|
---|
137 | exit 1
|
---|
138 | fi
|
---|
139 |
|
---|
140 | # Check that the system is setup correctly for the installation
|
---|
141 | have_bzip2="`check_bzip2; echo $?`" # Do we have bzip2?
|
---|
142 | have_gmake="`check_gmake; echo $?`" # Do we have GNU make?
|
---|
143 | have_ksource="`check_ksource; echo $?`" # Can we find the kernel source?
|
---|
144 | have_gcc="`check_gcc; echo $?`" # Is GCC installed?
|
---|
145 |
|
---|
146 | if [ $have_bzip2 -eq 1 -o $have_gmake -eq 1 -o $have_ksource -eq 1 \
|
---|
147 | -o $have_gcc -eq 1 ]; then
|
---|
148 | info "Problems were found which would prevent VirtualBox from installing."
|
---|
149 | info "Please correct these problems and try again."
|
---|
150 | log "Giving up due to the problems mentioned above."
|
---|
151 | exit 1
|
---|
152 | else
|
---|
153 | log "System setup appears correct."
|
---|
154 | log ""
|
---|
155 | fi
|
---|
156 |
|
---|
157 | # Sensible default actions
|
---|
158 | ACTION="install"
|
---|
159 | BUILD_MODULE="true"
|
---|
160 | while true
|
---|
161 | do
|
---|
162 | if [ "$2" = "" ]; then
|
---|
163 | break
|
---|
164 | fi
|
---|
165 | shift
|
---|
166 | case "$1" in
|
---|
167 | install)
|
---|
168 | ACTION="install"
|
---|
169 | ;;
|
---|
170 |
|
---|
171 | uninstall)
|
---|
172 | ACTION="uninstall"
|
---|
173 | ;;
|
---|
174 |
|
---|
175 | force)
|
---|
176 | FORCE_UPGRADE=1
|
---|
177 | ;;
|
---|
178 | license_accepted_unconditionally)
|
---|
179 | # Legacy option
|
---|
180 | ;;
|
---|
181 | no_module)
|
---|
182 | BUILD_MODULE=""
|
---|
183 | ;;
|
---|
184 | *)
|
---|
185 | if [ "$ACTION" = "" ]; then
|
---|
186 | info "Unknown command '$1'."
|
---|
187 | usage
|
---|
188 | fi
|
---|
189 | if [ "`echo $1|cut -c1`" != "/" ]; then
|
---|
190 | info "Please specify an absolute path"
|
---|
191 | usage
|
---|
192 | fi
|
---|
193 | INSTALLATION_DIR="$1"
|
---|
194 | ;;
|
---|
195 | esac
|
---|
196 | done
|
---|
197 |
|
---|
198 | if [ "$ACTION" = "install" ]; then
|
---|
199 | # Find previous installation
|
---|
200 | if [ ! -r $CONFIG_DIR/$CONFIG ]; then
|
---|
201 | mkdir -p $CONFIG_DIR
|
---|
202 | touch $CONFIG_DIR/$CONFIG
|
---|
203 | else
|
---|
204 | . $CONFIG_DIR/$CONFIG
|
---|
205 | PREV_INSTALLATION=$INSTALL_DIR
|
---|
206 | fi
|
---|
207 | if ! check_previous $INSTALL_DIR
|
---|
208 | then
|
---|
209 | info
|
---|
210 | info "You appear to have a version of VirtualBox on your system which was installed"
|
---|
211 | info "from a different source or using a different type of installer (or a damaged"
|
---|
212 | info "installation of VirtualBox). We strongly recommend that you remove it before"
|
---|
213 | info "installing this version of VirtualBox."
|
---|
214 | info
|
---|
215 | info "Do you wish to continue anyway? [yes or no]"
|
---|
216 | read reply dummy
|
---|
217 | if ! expr "$reply" : [yY] && ! expr "$reply" : [yY][eE][sS]
|
---|
218 | then
|
---|
219 | info
|
---|
220 | info "Cancelling installation."
|
---|
221 | log "User requested cancellation of the installation"
|
---|
222 | exit 1
|
---|
223 | fi
|
---|
224 | fi
|
---|
225 |
|
---|
226 | # Terminate Server and VBoxNetDHCP if running
|
---|
227 | terminate_proc VBoxSVC
|
---|
228 | terminate_proc VBoxNetDHCP
|
---|
229 |
|
---|
230 | # Remove previous installation
|
---|
231 | if [ -n "$PREV_INSTALLATION" -a -z "$FORCE_UPGRADE" -a ! "$VERSION" = "$INSTALL_VER" ] &&
|
---|
232 | expr "$INSTALL_VER" "<" "1.6.0" > /dev/null 2>&1
|
---|
233 | then
|
---|
234 | info
|
---|
235 | info "If you are upgrading from VirtualBox 1.5 or older and if some of your virtual"
|
---|
236 | info "machines have saved states, then the saved state information will be lost"
|
---|
237 | info "after the upgrade and will have to be discarded. If you do not want this then"
|
---|
238 | info "you can cancel the upgrade now."
|
---|
239 | info
|
---|
240 | info "Do you wish to continue? [yes or no]"
|
---|
241 | read reply dummy
|
---|
242 | if ! expr "$reply" : [yY] && ! expr "$reply" : [yY][eE][sS]
|
---|
243 | then
|
---|
244 | info
|
---|
245 | info "Cancelling upgrade."
|
---|
246 | log "User requested cancellation of the installation"
|
---|
247 | exit 1
|
---|
248 | fi
|
---|
249 | fi
|
---|
250 |
|
---|
251 | if [ ! "$VERSION" = "$INSTALL_VER" -a ! "$BUILD_MODULE" = "true" -a -n "$DKMS" ]
|
---|
252 | then
|
---|
253 | # Not doing this can confuse dkms
|
---|
254 | info "Rebuilding the kernel module after version change"
|
---|
255 | BUILD_MODULE=true
|
---|
256 | fi
|
---|
257 |
|
---|
258 | if [ -n "$PREV_INSTALLATION" ]; then
|
---|
259 | [ -n "$INSTALL_REV" ] && INSTALL_REV=" r$INSTALL_REV"
|
---|
260 | info "Removing previous installation of VirtualBox $INSTALL_VER$INSTALL_REV from $PREV_INSTALLATION"
|
---|
261 | log "Removing previous installation of VirtualBox $INSTALL_VER$INSTALL_REV from $PREV_INSTALLATION"
|
---|
262 | log ""
|
---|
263 |
|
---|
264 | stop_init_script vboxnet
|
---|
265 | delrunlevel vboxnet > /dev/null 2>&1
|
---|
266 | if [ "$BUILD_MODULE" = "true" ]; then
|
---|
267 | stop_init_script vboxdrv
|
---|
268 | if [ -n "$DKMS" ]
|
---|
269 | then
|
---|
270 | $DKMS remove -m vboxdrv -v $INSTALL_VER --all > /dev/null 2>&1
|
---|
271 | $DKMS remove -m vboxnetflt -v $INSTALL_VER --all > /dev/null 2>&1
|
---|
272 | $DKMS remove -m vboxnetadp -v $INSTALL_VER --all > /dev/null 2>&1
|
---|
273 | fi
|
---|
274 | # OSE doesn't always have the initscript
|
---|
275 | rmmod vboxnetadp > /dev/null 2>&1
|
---|
276 | rmmod vboxnetflt > /dev/null 2>&1
|
---|
277 | rmmod vboxdrv > /dev/null 2>&1
|
---|
278 |
|
---|
279 | module_loaded && {
|
---|
280 | info "Warning: could not stop VirtualBox kernel module."
|
---|
281 | info "Please restart your system to apply changes."
|
---|
282 | log "Unable to remove the old VirtualBox kernel module."
|
---|
283 | log " An old version of VirtualBox may be running."
|
---|
284 | }
|
---|
285 | else
|
---|
286 | VBOX_DONT_REMOVE_OLD_MODULES=1
|
---|
287 | fi
|
---|
288 |
|
---|
289 | VBOX_NO_UNINSTALL_MESSAGE=1
|
---|
290 | . ./uninstall.sh
|
---|
291 |
|
---|
292 | fi
|
---|
293 |
|
---|
294 | info "Installing VirtualBox to $INSTALLATION_DIR"
|
---|
295 | log "Installing VirtualBox to $INSTALLATION_DIR"
|
---|
296 | log ""
|
---|
297 |
|
---|
298 | # Verify the archive
|
---|
299 | mkdir -p $INSTALLATION_DIR
|
---|
300 | bzip2 -d -c VirtualBox.tar.bz2 | tar -tf - > $CONFIG_DIR/$CONFIG_FILES
|
---|
301 | RETVAL=$?
|
---|
302 | if [ $RETVAL != 0 ]; then
|
---|
303 | rmdir $INSTALLATION_DIR 2> /dev/null
|
---|
304 | rm -f $CONFIG_DIR/$CONFIG 2> /dev/null
|
---|
305 | rm -f $CONFIG_DIR/$CONFIG_FILES 2> /dev/null
|
---|
306 | log 'Error running "bzip2 -d -c VirtualBox.tar.bz2 | tar -tf - > '"$CONFIG_DIR/$CONFIG_FILES"'".'
|
---|
307 | abort "Error installing VirtualBox. Installation aborted"
|
---|
308 | fi
|
---|
309 |
|
---|
310 | # Create installation directory and install
|
---|
311 | bzip2 -d -c VirtualBox.tar.bz2 | tar -xf - -C $INSTALLATION_DIR
|
---|
312 | RETVAL=$?
|
---|
313 | if [ $RETVAL != 0 ]; then
|
---|
314 | cwd=`pwd`
|
---|
315 | cd $INSTALLATION_DIR
|
---|
316 | rm -f `cat $CONFIG_DIR/$CONFIG_FILES` 2> /dev/null
|
---|
317 | cd $pwd
|
---|
318 | rmdir $INSTALLATION_DIR 2> /dev/null
|
---|
319 | rm -f $CONFIG_DIR/$CONFIG 2> /dev/null
|
---|
320 | log 'Error running "bzip2 -d -c VirtualBox.tar.bz2 | tar -xf - -C '"$INSTALLATION_DIR"'".'
|
---|
321 | abort "Error installing VirtualBox. Installation aborted"
|
---|
322 | fi
|
---|
323 |
|
---|
324 | cp uninstall.sh routines.sh $INSTALLATION_DIR
|
---|
325 | echo "routines.sh" >> $CONFIG_DIR/$CONFIG_FILES
|
---|
326 | echo "uninstall.sh" >> $CONFIG_DIR/$CONFIG_FILES
|
---|
327 |
|
---|
328 | # XXX SELinux: allow text relocation entries
|
---|
329 | if [ -x /usr/bin/chcon ]; then
|
---|
330 | chcon -t texrel_shlib_t $INSTALLATION_DIR/VBox* > /dev/null 2>&1
|
---|
331 | chcon -t texrel_shlib_t $INSTALLATION_DIR/VRDPAuth.so > /dev/null 2>&1
|
---|
332 | chcon -t texrel_shlib_t $INSTALLATION_DIR/VirtualBox.so > /dev/null 2>&1
|
---|
333 | chcon -t texrel_shlib_t $INSTALLATION_DIR/components/VBox*.so > /dev/null 2>&1
|
---|
334 | chcon -t java_exec_t $INSTALLATION_DIR/VirtualBox > /dev/null 2>&1
|
---|
335 | chcon -t java_exec_t $INSTALLATION_DIR/VBoxSDL > /dev/null 2>&1
|
---|
336 | chcon -t java_exec_t $INSTALLATION_DIR/VBoxHeadless > /dev/null 2>&1
|
---|
337 | chcon -t java_exec_t $INSTALLATION_DIR/VBoxNetDHCP > /dev/null 2>&1
|
---|
338 | chcon -t java_exec_t $INSTALLATION_DIR/vboxwebsrv > /dev/null 2>&1
|
---|
339 | chcon -t java_exec_t $INSTALLATION_DIR/webtest > /dev/null 2>&1
|
---|
340 | fi
|
---|
341 |
|
---|
342 | # Hardened build: Mark selected binaries set-user-ID-on-execution,
|
---|
343 | # create symlinks for working around unsupported $ORIGIN/.. in VBoxC.so (setuid),
|
---|
344 | # and finally make sure the directory is only writable by the user (paranoid).
|
---|
345 | if [ -n "$HARDENED" ]; then
|
---|
346 | test -e $INSTALLATION_DIR/VirtualBox && chmod 4511 $INSTALLATION_DIR/VirtualBox
|
---|
347 | test -e $INSTALLATION_DIR/VBoxSDL && chmod 4511 $INSTALLATION_DIR/VBoxSDL
|
---|
348 | test -e $INSTALLATION_DIR/VBoxHeadless && chmod 4511 $INSTALLATION_DIR/VBoxHeadless
|
---|
349 | test -e $INSTALLATION_DIR/VBoxNetDHCP && chmod 4511 $INSTALLATION_DIR/VBoxNetDHCP
|
---|
350 |
|
---|
351 | ln -sf $INSTALLATION_DIR/VBoxVMM.so $INSTALLATION_DIR/components/VBoxVMM.so
|
---|
352 | ln -sf $INSTALLATION_DIR/VBoxREM.so $INSTALLATION_DIR/components/VBoxREM.so
|
---|
353 | ln -sf $INSTALLATION_DIR/VBoxRT.so $INSTALLATION_DIR/components/VBoxRT.so
|
---|
354 | ln -sf $INSTALLATION_DIR/VBoxDDU.so $INSTALLATION_DIR/components/VBoxDDU.so
|
---|
355 | ln -sf $INSTALLATION_DIR/VBoxXPCOM.so $INSTALLATION_DIR/components/VBoxXPCOM.so
|
---|
356 |
|
---|
357 | chmod go-w $INSTALLATION_DIR
|
---|
358 | fi
|
---|
359 |
|
---|
360 | # This binary needs to be suid root in any case, even if not hardened
|
---|
361 | test -e $INSTALLATION_DIR/VBoxNetAdpCtl && chmod 4511 $INSTALLATION_DIR/VBoxNetAdpCtl
|
---|
362 |
|
---|
363 | # Install runlevel scripts
|
---|
364 | install_init_script vboxdrv.sh vboxdrv
|
---|
365 | delrunlevel vboxdrv > /dev/null 2>&1
|
---|
366 | addrunlevel vboxdrv 20 80 # This may produce useful output
|
---|
367 |
|
---|
368 | # Create users group
|
---|
369 | groupadd $GROUPNAME 2> /dev/null
|
---|
370 |
|
---|
371 | # Create symlinks to start binaries
|
---|
372 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VirtualBox
|
---|
373 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxManage
|
---|
374 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxSDL
|
---|
375 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxVRDP
|
---|
376 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxHeadless
|
---|
377 | ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/vboxwebsrv
|
---|
378 | ln -sf $INSTALLATION_DIR/VBox.png /usr/share/pixmaps/VBox.png
|
---|
379 | ln -sf $INSTALLATION_DIR/virtualbox.desktop /usr/share/applications/virtualbox.desktop
|
---|
380 | ln -sf $INSTALLATION_DIR/rdesktop-vrdp /usr/bin/rdesktop-vrdp
|
---|
381 | ln -sf $INSTALLATION_DIR/src/vboxdrv /usr/src/vboxdrv-_VERSION_
|
---|
382 | ln -sf $INSTALLATION_DIR/src/vboxnetflt /usr/src/vboxnetflt-_VERSION_
|
---|
383 | ln -sf $INSTALLATION_DIR/src/vboxnetadp /usr/src/vboxnetadp-_VERSION_
|
---|
384 |
|
---|
385 | # If Python is available, install Python bindings
|
---|
386 | if [ -n "$PYTHON" ]; then
|
---|
387 | maybe_run_python_bindings_installer $INSTALLATION_DIR
|
---|
388 | fi
|
---|
389 |
|
---|
390 | # Create udev description file
|
---|
391 | if [ -d /etc/udev/rules.d ]; then
|
---|
392 | udev_call=""
|
---|
393 | udev_app=`which udevadm 2> /dev/null`
|
---|
394 | if [ $? -eq 0 ]; then
|
---|
395 | udev_call="${udev_app} version 2> /dev/null"
|
---|
396 | else
|
---|
397 | udev_app=`which udevinfo 2> /dev/null`
|
---|
398 | if [ $? -eq 0 ]; then
|
---|
399 | udev_call="${udev_app} -V 2> /dev/null"
|
---|
400 | fi
|
---|
401 | fi
|
---|
402 | udev_fix="="
|
---|
403 | if [ "${udev_call}" != "" ]; then
|
---|
404 | udev_out=`${udev_call}`
|
---|
405 | udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
|
---|
406 | if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
|
---|
407 | udev_fix=""
|
---|
408 | fi
|
---|
409 | fi
|
---|
410 | # Write udev rules
|
---|
411 | echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\"" \
|
---|
412 | > /etc/udev/rules.d/10-vboxdrv.rules
|
---|
413 | echo "SUBSYSTEM=${udev_fix}\"usb_device\", GROUP=\"$VBOXUSB_GRP\", MODE=\"$VBOXUSB_MODE\"" \
|
---|
414 | >> /etc/udev/rules.d/10-vboxdrv.rules
|
---|
415 | echo "SUBSYSTEM=${udev_fix}\"usb\", ENV{DEVTYPE}==\"usb_device\", GROUP=\"$VBOXUSB_GRP\", MODE=\"$VBOXUSB_MODE\"" \
|
---|
416 | >> /etc/udev/rules.d/10-vboxdrv.rules
|
---|
417 | fi
|
---|
418 | # Remove old udev description file
|
---|
419 | if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then
|
---|
420 | rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
|
---|
421 | fi
|
---|
422 |
|
---|
423 | # Push the permissions to the USB device nodes. One of these should match.
|
---|
424 | # Rather nasty to use udevadm trigger for this, but I don't know of any
|
---|
425 | # better way.
|
---|
426 | udevadm trigger --subsystem-match=usb > /dev/null 2>&1
|
---|
427 | udevtrigger --subsystem-match=usb > /dev/null 2>&1
|
---|
428 | udevtrigger --subsystem-match=usb_device > /dev/null 2>&1
|
---|
429 | udevplug -Busb > /dev/null 2>&1
|
---|
430 |
|
---|
431 | # Make kernel module
|
---|
432 | MODULE_FAILED="false"
|
---|
433 | if [ "$BUILD_MODULE" = "true" ]
|
---|
434 | then
|
---|
435 | info "Building the VirtualBox vboxdrv kernel module"
|
---|
436 | log "Output from the module build process (the Linux kernel build system) follows:"
|
---|
437 | cur=`pwd`
|
---|
438 | log ""
|
---|
439 | cd $INSTALLATION_DIR/src/vboxdrv
|
---|
440 | ./build_in_tmp \
|
---|
441 | --save-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
442 | --no-print-directory install >> $LOG 2>&1
|
---|
443 | RETVAL=$?
|
---|
444 | if [ $RETVAL -ne 0 ]
|
---|
445 | then
|
---|
446 | info "Failed to build the vboxdrv kernel module."
|
---|
447 | info "Please check the log file $LOG for more information."
|
---|
448 | MODULE_FAILED="true"
|
---|
449 | RC_SCRIPT=1
|
---|
450 | else
|
---|
451 | info "Building the VirtualBox netflt kernel module"
|
---|
452 | log "Output from the module build process (the Linux kernel build system) follows:"
|
---|
453 | cd $INSTALLATION_DIR/src/vboxnetflt
|
---|
454 | ./build_in_tmp \
|
---|
455 | --use-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
456 | --no-print-directory install >> $LOG 2>&1
|
---|
457 | RETVAL=$?
|
---|
458 | if [ $RETVAL -ne 0 ]
|
---|
459 | then
|
---|
460 | info "Failed to build the vboxnetflt kernel module."
|
---|
461 | info "Please check the log file $LOG for more information."
|
---|
462 | MODULE_FAILED="true"
|
---|
463 | RC_SCRIPT=1
|
---|
464 | else
|
---|
465 | info "Building the VirtualBox netadp kernel module"
|
---|
466 | log "Output from the module build process (the Linux kernel build system) follows:"
|
---|
467 | cd $INSTALLATION_DIR/src/vboxnetadp
|
---|
468 | ./build_in_tmp \
|
---|
469 | --use-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
470 | --no-print-directory install >> $LOG 2>&1
|
---|
471 | RETVAL=$?
|
---|
472 | if [ $RETVAL -ne 0 ]
|
---|
473 | then
|
---|
474 | info "Failed to build the vboxnetadp kernel module."
|
---|
475 | info "Please check the log file $LOG for more information."
|
---|
476 | MODULE_FAILED="true"
|
---|
477 | RC_SCRIPT=1
|
---|
478 | fi
|
---|
479 | fi
|
---|
480 | fi
|
---|
481 | # cleanup
|
---|
482 | rm -f /tmp/vboxdrv-Module.symvers
|
---|
483 | # Start VirtualBox kernel module
|
---|
484 | if [ $RETVAL -eq 0 ] && ! start_init_script vboxdrv; then
|
---|
485 | info "Failed to load the kernel module."
|
---|
486 | MODULE_FAILED="true"
|
---|
487 | RC_SCRIPT=1
|
---|
488 | fi
|
---|
489 | log ""
|
---|
490 | log "End of the output from the Linux kernel build system."
|
---|
491 | cd $cur
|
---|
492 | fi
|
---|
493 |
|
---|
494 | echo "# VirtualBox installation directory" > $CONFIG_DIR/$CONFIG
|
---|
495 | echo "INSTALL_DIR='$INSTALLATION_DIR'" >> $CONFIG_DIR/$CONFIG
|
---|
496 | echo "# VirtualBox version" >> $CONFIG_DIR/$CONFIG
|
---|
497 | echo "INSTALL_VER='$VERSION'" >> $CONFIG_DIR/$CONFIG
|
---|
498 | echo "INSTALL_REV='$SVNREV'" >> $CONFIG_DIR/$CONFIG
|
---|
499 | info ""
|
---|
500 | if [ ! "$MODULE_FAILED" = "true" ]
|
---|
501 | then
|
---|
502 | info "VirtualBox has been installed successfully."
|
---|
503 | else
|
---|
504 | info "VirtualBox has been installed successfully, but the kernel module could not"
|
---|
505 | info "be built. When you have fixed the problems preventing this, execute"
|
---|
506 | info " /etc/init.d/vboxdrv setup"
|
---|
507 | info "as administrator to build it."
|
---|
508 | fi
|
---|
509 | info ""
|
---|
510 | info "You will find useful information about using VirtualBox in the user manual"
|
---|
511 | info " $INSTALLATION_DIR/UserManual.pdf"
|
---|
512 | info "and in the user FAQ"
|
---|
513 | info " http://www.virtualbox.org/wiki/User_FAQ"
|
---|
514 | info ""
|
---|
515 | info "We hope that you enjoy using VirtualBox."
|
---|
516 | info ""
|
---|
517 | log "Installation successful"
|
---|
518 | elif [ "$ACTION" = "uninstall" ]; then
|
---|
519 | . ./uninstall.sh
|
---|
520 | fi
|
---|
521 | exit $RC_SCRIPT
|
---|