Magellan Linux

Contents of /trunk/virtualbox/virtualbox-wrapper.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (show annotations) (download) (as text)
Fri Apr 13 22:52:00 2007 UTC (17 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1239 byte(s)
-added missing exit 1

1 #!/bin/bash
2 # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.2 2007-04-13 22:52:00 niro Exp $
3 # Wrapper for virtual for Magellan-Linux
4
5 LIBDIR=/usr/lib
6 INSTDIR=${LIBDIR}/virtualbox
7 XPCOM_DAEMON=VBoxSVC
8 VBOXCONFIG=$HOME/.VirtualBox
9 VBOXLOG=${VBOXCONFIG}/log
10
11 # check for the vbox module
12 if [[ ! -w /dev/vboxdrv ]]
13 then
14 echo "Please make sure that you have the virtualbox kernel module installed and loaded."
15 echo "Run 'virtualbox-config' to get the kernel module compiled and installed."
16 exit 1
17 fi
18
19 # set lib dir
20 export LD_LIBRARY_PATH="${INSTDIR}"
21
22 # check for the vbox XPCOM daemon
23 pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' )
24
25 # kill all running instances for $USER
26 if [[ -n ${pid} ]]
27 then
28 kill -TERM ${pid}
29 sleep 2
30
31 # kill the pidfile
32 rm -rf /tmp/.vbox-$USER-ipc
33 fi
34
35 # start the daemon
36 install -d ${VBOXCONFIG}
37 ${INSTDIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1
38
39 # start the proper application
40 case $(basename $0) in
41 virtualbox)
42 exec ${INSTDIR}/VirtualBox $*
43 ;;
44 vboxmanage)
45 exec ${INSTDIR}/VBoxManage $*
46 ;;
47 vboxsdl)
48 exec ${INSTDIR}/VBoxSDL $*
49 ;;
50 vboxbfe)
51 exec ${INSTDIR}/VBoxBFE $*
52 ;;
53 *)
54 echo "Error: Unknown application - $(basename $0)"
55 exit 1
56 ;;
57 esac