VirtualBox

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

Last change on this file since 4001 was 3864, checked in by vboxsync, 17 years ago

export these two to OSE

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