#!/bin/bash # $Id$ # Wrapper for virtual for Magellan-Linux source /etc/vbox/vbox.cfg XPCOM_DAEMON=VBoxSVC VBOXCONFIG=$HOME/.VirtualBox VBOXLOG=${VBOXCONFIG}/log COLRED="\033[1;6m\033[31m" COLDEFAULT="\033[0m" if [[ ${NOCOLORS} = true ]] then COLRED="" COLDEFAULT="" fi # check for the vbox module if [[ ! -w /dev/vboxdrv ]] then if [[ ! -z ${DISPLAY} ]] then dialog() { xterm -T "VirtualBox" -e "echo -e \"$@\"; echo; echo \"Press [Enter] to continue ...\"; read"; } [[ -x /usr/bin/xmessage ]] && dialog() { echo -e "$@" | /usr/bin/xmessage -center -button cancel -file -; } [[ -x /usr/bin/Xdialog ]] && dialog() { /usr/bin/Xdialog --no-ok --center --infobox "$@" 0 0; } dialog "Please make sure that you have the virtualbox kernel module installed and loaded Run 'virtualbox-config' to get the kernel module compiled and installed." fi echo -e ${COLRED}"Please make sure that you have the virtualbox kernel module installed and loaded."${COLDEFAULT} echo -e ${COLRED}"Run 'virtualbox-config' to get the kernel module compiled and installed."${COLDEFAULT} exit 1 fi # set lib dir export LD_LIBRARY_PATH="${INSTALL_DIR}" # check for the vbox XPCOM daemon pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' ) # kill all running instances for $USER if [[ -n ${pid} ]] then kill -TERM ${pid} sleep 2 # kill the pidfile rm -rf /tmp/.vbox-$USER-ipc fi # start the daemon install -d ${VBOXCONFIG} ${INSTALL_DIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1 # start the proper application case $(basename $0) in virtualbox) exec ${INSTALL_DIR}/VirtualBox $* ;; vboxmanage) exec ${INSTALL_DIR}/VBoxManage $* ;; vboxsdl) exec ${INSTALL_DIR}/VBoxSDL $* ;; vboxbfe) exec ${INSTALL_DIR}/VBoxBFE $* ;; vboxheadless|vboxvrdp) exec ${INSTALL_DIR}/VBoxHeadless $* ;; *) echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT} exit 1 ;; esac