VirtualBox

source: vbox/trunk/debian/VBox.sh@ 4168

Last change on this file since 4168 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 3.1 KB
Line 
1#!/bin/sh
2#
3# innotek VirtualBox
4#
5# Copyright (C) 2006-2007 innotek GmbH
6#
7# This file is part of VirtualBox Open Source Edition (OSE), as
8# available from http://www.virtualbox.org. This file is free software;
9# you can redistribute it and/or modify it under the terms of the GNU
10# General Public License as published by the Free Software Foundation,
11# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
12# distribution. VirtualBox OSE is distributed in the hope that it will
13# be useful, but WITHOUT ANY WARRANTY of any kind.
14
15PATH="/usr/bin:/bin:/usr/sbin:/sbin"
16
17# Note: This script must not fail if the module was not successfully installed
18# because the user might not want to run a VM but only change VM params!
19
20if [ "$1" = "shutdown" ]; then
21 SHUTDOWN="true"
22elif ! lsmod|grep -q vboxdrv; then
23 cat << EOF
24WARNING: The vboxdrv kernel module is not loaded. Either there is no module
25 available for the current kernel (`uname -r`) or it failed to
26 load. Please recompile the kernel module and install it by
27
28 sudo /etc/init.d/vboxdrv setup
29
30 You will not be able to start VMs until this problem is fixed.
31EOF
32elif [ ! -c /dev/vboxdrv ]; then
33 cat << EOF
34WARNING: The character device /dev/vboxdrv does not exist. Try
35
36 sudo /etc/init.d/virtualbox restart
37
38 and if that is not successful, try to re-install the package.
39
40 You will not be able to start VMs until this problem is fixed.
41EOF
42elif [ ! -w /dev/vboxdrv ]; then
43 if [ "`id | grep vboxusers`" = "" ]; then
44 cat << EOF
45WARNING: You are not a member of the "vboxusers" group. Please add yourself
46 to this group before starting VirtualBox.
47
48 You will not be able to start VMs until this problem is fixed.
49EOF
50 else
51 cat << EOF
52WARNING: /dev/vboxdrv not writable for some reason. If you recently added the
53 current user to the vboxusers group then you have to logout and
54 re-login to take the change effect.
55
56 You will not be able to start VMs until this problem is fixed.
57EOF
58 fi
59fi
60
61if [ -f /etc/vbox/module_not_compiled ]; then
62 cat << EOF
63WARNING: The compilation of the vboxdrv.ko kernel module failed during the
64 installation for some reason. Starting a VM will not be possible.
65 Please consult the User Manual for build instructions.
66EOF
67fi
68
69SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
70if [ -z "$SERVER_PID" ]; then
71 # Server not running yet/anymore, cleanup socket path.
72 # See IPC_GetDefaultSocketPath()!
73 if [ -n "$LOGNAME" ]; then
74 rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
75 else
76 rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
77 fi
78fi
79
80if [ "$SHUTDOWN" = "true" ]; then
81 if [ -n "$SERVER_PID" ]; then
82 kill -TERM $SERVER_PID
83 sleep 2
84 fi
85 exit 0
86fi
87
88APP=`which $0`
89APP=${APP##/*/}
90case "$APP" in
91 VirtualBox)
92 exec "/usr/lib/virtualbox/VirtualBox" "$@"
93 ;;
94 VBoxManage)
95 exec "/usr/lib/virtualbox/VBoxManage" "$@"
96 ;;
97 VBoxSDL)
98 exec "/usr/lib/virtualbox/VBoxSDL" "$@"
99 ;;
100 VBoxVRDP)
101 exec "/usr/lib/virtualbox/VBoxVRDP" "$@"
102 ;;
103 *)
104 echo "Unknown application - $APP"
105 ;;
106esac
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