Contents of /trunk/virtualbox/virtualbox-wrapper.sh
Parent Directory | Revision Log
Revision 130 -
(show annotations)
(download)
(as text)
Sat Apr 14 14:11:02 2007 UTC (17 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1426 byte(s)
Sat Apr 14 14:11:02 2007 UTC (17 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1426 byte(s)
- colored messages
1 | #!/bin/bash |
2 | # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.3 2007-04-14 14:11:02 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 | COLRED="\033[1;6m\033[31m" |
12 | COLDEFAULT="\033[0m" |
13 | |
14 | if [[ ${NOCOLORS} = true ]] |
15 | then |
16 | COLRED="" |
17 | COLDEFAULT="" |
18 | fi |
19 | |
20 | # check for the vbox module |
21 | if [[ ! -w /dev/vboxdrv ]] |
22 | then |
23 | echo -e ${COLRED}"Please make sure that you have the virtualbox kernel module installed and loaded."${COLDEFAULT} |
24 | echo -e ${COLRED}"Run 'virtualbox-config' to get the kernel module compiled and installed."${COLDEFAULT} |
25 | exit 1 |
26 | fi |
27 | |
28 | # set lib dir |
29 | export LD_LIBRARY_PATH="${INSTDIR}" |
30 | |
31 | # check for the vbox XPCOM daemon |
32 | pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' ) |
33 | |
34 | # kill all running instances for $USER |
35 | if [[ -n ${pid} ]] |
36 | then |
37 | kill -TERM ${pid} |
38 | sleep 2 |
39 | |
40 | # kill the pidfile |
41 | rm -rf /tmp/.vbox-$USER-ipc |
42 | fi |
43 | |
44 | # start the daemon |
45 | install -d ${VBOXCONFIG} |
46 | ${INSTDIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1 |
47 | |
48 | # start the proper application |
49 | case $(basename $0) in |
50 | virtualbox) |
51 | exec ${INSTDIR}/VirtualBox $* |
52 | ;; |
53 | vboxmanage) |
54 | exec ${INSTDIR}/VBoxManage $* |
55 | ;; |
56 | vboxsdl) |
57 | exec ${INSTDIR}/VBoxSDL $* |
58 | ;; |
59 | vboxbfe) |
60 | exec ${INSTDIR}/VBoxBFE $* |
61 | ;; |
62 | *) |
63 | echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT} |
64 | exit 1 |
65 | ;; |
66 | esac |