VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/VBox.sh@ 56874

Last change on this file since 56874 was 56299, checked in by vboxsync, 10 years ago

Installer: Updated (C) year.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1#!/bin/sh
2## @file
3# Oracle VM VirtualBox startup script, Linux hosts.
4#
5
6#
7# Copyright (C) 2006-2015 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
18PATH="/usr/bin:/bin:/usr/sbin:/sbin"
19CONFIG="/etc/vbox/vbox.cfg"
20
21test -r "${CONFIG}" &&
22 . "${CONFIG}"
23test -z "${INSTALL_DIR}" &&
24 if test -f /usr/lib/virtualbox/VirtualBox &&
25 test -x /usr/lib/virtualbox/VirtualBox; then
26 INSTALL_DIR=/usr/lib/virtualbox
27 else
28 echo "Could not find VirtualBox installation. Please reinstall."
29 exit 1
30 fi
31
32# Note: This script must not fail if the module was not successfully installed
33# because the user might not want to run a VM but only change VM params!
34
35if [ "$1" = "shutdown" ]; then
36 SHUTDOWN="true"
37elif ! lsmod|grep -q vboxdrv; then
38 cat << EOF
39WARNING: The vboxdrv kernel module is not loaded. Either there is no module
40 available for the current kernel (`uname -r`) or it failed to
41 load. Please recompile the kernel module and install it by
42
43 sudo /etc/init.d/vboxdrv setup
44
45 You will not be able to start VMs until this problem is fixed.
46EOF
47elif [ ! -c /dev/vboxdrv ]; then
48 cat << EOF
49WARNING: The character device /dev/vboxdrv does not exist. Try
50
51 sudo /etc/init.d/vboxdrv restart
52
53 and if that is not successful, try to re-install the package.
54
55 You will not be able to start VMs until this problem is fixed.
56EOF
57fi
58
59if [ -f /etc/vbox/module_not_compiled ]; then
60 cat << EOF
61WARNING: The compilation of the vboxdrv.ko kernel module failed during the
62 installation for some reason. Starting a VM will not be possible.
63 Please consult the User Manual for build instructions.
64EOF
65fi
66
67SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
68if [ -z "$SERVER_PID" ]; then
69 # Server not running yet/anymore, cleanup socket path.
70 # See IPC_GetDefaultSocketPath()!
71 if [ -n "$LOGNAME" ]; then
72 rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
73 else
74 rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
75 fi
76fi
77
78if [ "$SHUTDOWN" = "true" ]; then
79 if [ -n "$SERVER_PID" ]; then
80 kill -TERM $SERVER_PID
81 sleep 2
82 fi
83 exit 0
84fi
85
86APP=`basename $0`
87case "$APP" in
88 VirtualBox|virtualbox)
89 exec "$INSTALL_DIR/VirtualBox" "$@"
90 ;;
91 VBoxManage|vboxmanage)
92 exec "$INSTALL_DIR/VBoxManage" "$@"
93 ;;
94 VBoxSDL|vboxsdl)
95 exec "$INSTALL_DIR/VBoxSDL" "$@"
96 ;;
97 VBoxVRDP|VBoxHeadless|vboxheadless)
98 exec "$INSTALL_DIR/VBoxHeadless" "$@"
99 ;;
100 VBoxAutostart|vboxautostart)
101 exec "$INSTALL_DIR/VBoxAutostart" "$@"
102 ;;
103 VBoxBalloonCtrl|vboxballoonctrl)
104 exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
105 ;;
106 VBoxDTrace|vboxdtrace)
107 exec "$INSTALL_DIR/VBoxDTrace" "$@"
108 ;;
109 vboxwebsrv)
110 exec "$INSTALL_DIR/vboxwebsrv" "$@"
111 ;;
112 *)
113 echo "Unknown application - $APP"
114 exit 1
115 ;;
116esac
117exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette