| 1 | #!/bin/sh |
|---|
| 2 | # |
|---|
| 3 | # written by Patrick Winnertz <patrick.winnertz@skolelinux.org> and |
|---|
| 4 | # Michael Meskes <meskes@debian.org> |
|---|
| 5 | # and placed under GPLv2 |
|---|
| 6 | # |
|---|
| 7 | # this is based on a script by |
|---|
| 8 | # InnoTek VirtualBox |
|---|
| 9 | # |
|---|
| 10 | # Copyright (C) 2006 InnoTek Systemberatung GmbH |
|---|
| 11 | # |
|---|
| 12 | # This file is part of VirtualBox Open Source Edition (OSE), as |
|---|
| 13 | # available from http://www.virtualbox.org. This file is free software; |
|---|
| 14 | # you can redistribute it and/or modify it under the terms of the GNU |
|---|
| 15 | # General Public License as published by the Free Software Foundation, |
|---|
| 16 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE |
|---|
| 17 | # distribution. VirtualBox OSE is distributed in the hope that it will |
|---|
| 18 | # be useful, but WITHOUT ANY WARRANTY of any kind. |
|---|
| 19 | |
|---|
| 20 | PATH="/usr/bin:/bin:/usr/sbin:/sbin" |
|---|
| 21 | CONFIG="/etc/vbox/vbox.cfg" |
|---|
| 22 | |
|---|
| 23 | if [ "$VBOX_USER_HOME" = "" ]; then |
|---|
| 24 | if [ ! -d "$HOME/.VirtualBox" ]; then |
|---|
| 25 | mkdir -p "$HOME/.VirtualBox" |
|---|
| 26 | fi |
|---|
| 27 | LOG="$HOME/.VirtualBox/VBoxSVC.log" |
|---|
| 28 | else |
|---|
| 29 | if [ ! -d "$VBOX_USER_HOME" ]; then |
|---|
| 30 | mkdir -p "$VBOX_USER_HOME" |
|---|
| 31 | fi |
|---|
| 32 | LOG="$VBOX_USER_HOME/VBoxSVC.log" |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 35 | if [ ! -r "$CONFIG" ]; then |
|---|
| 36 | echo "Could not find VirtualBox installation. Please reinstall." |
|---|
| 37 | exit 1 |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | . "$CONFIG_DIR/$CONFIG" |
|---|
| 41 | |
|---|
| 42 | # Note: This script must not fail if the module was not successfully installed |
|---|
| 43 | # because the user might not want to run a VM but only change VM params! |
|---|
| 44 | |
|---|
| 45 | if [ ! -c /dev/vboxdrv ]; then |
|---|
| 46 | cat << EOF |
|---|
| 47 | WARNING: The character device /dev/vboxdrv does not exist. |
|---|
| 48 | Please install the virtualbox-ose-modules package for your kernel and |
|---|
| 49 | load the module named vboxdrv into your system. |
|---|
| 50 | |
|---|
| 51 | You will not be able to start VMs until this problem is fixed. |
|---|
| 52 | EOF |
|---|
| 53 | fi |
|---|
| 54 | |
|---|
| 55 | export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$INSTALL_DIR" |
|---|
| 56 | |
|---|
| 57 | APP=`which $0` |
|---|
| 58 | APP=${APP##/*/} |
|---|
| 59 | case "$APP" in |
|---|
| 60 | VirtualBox|virtualbox) |
|---|
| 61 | exec "$INSTALL_DIR/VirtualBox" "$@" |
|---|
| 62 | ;; |
|---|
| 63 | VBoxHeadless|vboxheadless) |
|---|
| 64 | exec "$INSTALL_DIR/VBoxHeadless" "$@" |
|---|
| 65 | ;; |
|---|
| 66 | VBoxManage|vboxmanage) |
|---|
| 67 | exec "$INSTALL_DIR/VBoxManage" "$@" |
|---|
| 68 | ;; |
|---|
| 69 | VBoxSDL|vboxsdl) |
|---|
| 70 | exec "$INSTALL_DIR/VBoxSDL" "$@" |
|---|
| 71 | ;; |
|---|
| 72 | vditool) |
|---|
| 73 | exec "$INSTALL_DIR/vditool" "$@" |
|---|
| 74 | ;; |
|---|
| 75 | *) |
|---|
| 76 | echo "Unknown application - $APP" |
|---|
| 77 | ;; |
|---|
| 78 | esac |
|---|