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