#!/bin/bash # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.1 2007-04-13 21:55:56 niro Exp $ # Wrapper for virtual for Magellan-Linux LIBDIR=/usr/lib INSTDIR=${LIBDIR}/virtualbox XPCOM_DAEMON=VBoxSVC VBOXCONFIG=$HOME/.VirtualBox VBOXLOG=${VBOXCONFIG}/log # check for the vbox module if [[ ! -w /dev/vboxdrv ]] then echo "Please make sure that you have the virtualbox kernel module installed and loaded." echo "Run 'virtualbox-config' to get the kernel module compiled and installed." fi # set lib dir export LD_LIBRARY_PATH="${INSTDIR}" # 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} ${INSTDIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1 # start the proper application case $(basename $0) in virtualbox) exec ${INSTDIR}/VirtualBox $* ;; vboxmanage) exec ${INSTDIR}/VBoxManage $* ;; vboxsdl) exec ${INSTDIR}/VBoxSDL $* ;; vboxbfe) exec ${INSTDIR}/VBoxBFE $* ;; *) echo "Error: Unknown application - $(basename $0)" exit 1 ;; esac