Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.53 KB | None | 0 0
  1. #!/bin/sh
  2. ## @file
  3. # Oracle VM VirtualBox startup script, Linux hosts.
  4. #
  5.  
  6. # written by Patrick Winnertz <[email protected]> and
  7. # Michael Meskes <[email protected]>
  8. # and placed under GPLv2
  9. #
  10. # this is based on a script by
  11. # Oracle VirtualBox
  12. #
  13. # Copyright (C) 2006-2015 Oracle Corporation
  14. #
  15. # This file is part of VirtualBox Open Source Edition (OSE), as
  16. # available from http://www.virtualbox.org. This file is free software;
  17. # you can redistribute it and/or modify it under the terms of the GNU
  18. # General Public License (GPL) as published by the Free Software
  19. # Foundation, in version 2 as it comes in the "COPYING" file of the
  20. # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  21. # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  22. #
  23.  
  24. PATH="/usr/bin:/bin:/usr/sbin:/sbin"
  25.  
  26. # VirtualBox installation directory
  27. INSTALL_DIR="/usr/lib/virtualbox"
  28.  
  29. # Note: This script must not fail if the module was not successfully installed
  30. #       because the user might not want to run a VM but only change VM params!
  31.  
  32. if [ ! -c /dev/vboxdrv ]; then
  33.     cat << EOF
  34. WARNING: The character device /dev/vboxdrv does not exist.
  35.      Please install the virtualbox-dkms package and the appropriate
  36.      headers, most likely linux-headers-$(uname -r | cut -d- -f3).
  37.  
  38.      You will not be able to start VMs until this problem is fixed.
  39. EOF
  40. fi
  41.  
  42. SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
  43. if [ -z "$SERVER_PID" ]; then
  44.     # Server not running yet/anymore, cleanup socket path.
  45.     # See IPC_GetDefaultSocketPath()!
  46.     if [ -n "$LOGNAME" ]; then
  47.         rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
  48.     else
  49.         rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
  50.     fi
  51. fi
  52.  
  53. APP=`basename $0`
  54. case "$APP" in
  55.     VirtualBox|virtualbox)
  56.         exec "$INSTALL_DIR/VirtualBox" "$@"
  57.         ;;
  58.     VBoxManage|vboxmanage)
  59.         exec "$INSTALL_DIR/VBoxManage" "$@"
  60.         ;;
  61.     VBoxSDL|vboxsdl)
  62.         exec "$INSTALL_DIR/VBoxSDL" "$@"
  63.         ;;
  64.     VBoxVRDP|VBoxHeadless|vboxheadless)
  65.         exec "$INSTALL_DIR/VBoxHeadless" "$@"
  66.         ;;
  67.     VBoxAutostart|vboxautostart)
  68.         exec "$INSTALL_DIR/VBoxAutostart" "$@"
  69.         ;;
  70.     VBoxBalloonCtrl|vboxballoonctrl)
  71.         exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
  72.         ;;
  73.     VBoxDTrace|vboxdtrace)
  74.         exec "$INSTALL_DIR/VBoxDTrace" "$@"
  75.         ;;
  76.     vboxwebsrv)
  77.         exec "$INSTALL_DIR/vboxwebsrv" "$@"
  78.         ;;
  79.     *)
  80.         echo "Unknown application - $APP"
  81.         exit 1
  82.         ;;
  83. esac
  84. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement