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