1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.4 2008-03-27 14:14:30 niro Exp $ |
# $Id$ |
3 |
# Wrapper for virtual for Magellan-Linux |
# Wrapper for virtual for Magellan-Linux |
4 |
|
|
5 |
LIBDIR=/usr/lib |
source /etc/vbox/vbox.cfg |
6 |
INSTDIR=${LIBDIR}/virtualbox |
|
7 |
XPCOM_DAEMON=VBoxSVC |
XPCOM_DAEMON=VBoxSVC |
8 |
VBOXCONFIG=$HOME/.VirtualBox |
VBOXCONFIG=$HOME/.VirtualBox |
9 |
VBOXLOG=${VBOXCONFIG}/log |
VBOXLOG=${VBOXCONFIG}/log |
22 |
then |
then |
23 |
if [[ ! -z ${DISPLAY} ]] |
if [[ ! -z ${DISPLAY} ]] |
24 |
then |
then |
25 |
dialog() { xterm -e "echo -e \"$@\"; echo; echo \"Press [Enter] to continue ...\"; read"; } |
dialog() { xterm -T "VirtualBox" -e "echo -e \"$@\"; echo; echo \"Press [Enter] to continue ...\"; read"; } |
26 |
[[ -x /usr/bin/xmessage ]] && dialog() { echo -e "$@" | /usr/bin/xmessage -center -button cancel -file -; } |
[[ -x /usr/bin/xmessage ]] && dialog() { echo -e "$@" | /usr/bin/xmessage -center -button cancel -file -; } |
27 |
[[ -x /usr/bin/Xdialog ]] && dialog() { /usr/bin/Xdialog --infobox "$@" 0 0 --no-ok --center; } |
[[ -x /usr/bin/Xdialog ]] && dialog() { /usr/bin/Xdialog --no-ok --center --infobox "$@" 0 0; } |
28 |
|
|
29 |
dialog "Please make sure that you have the virtualbox kernel module installed and loaded.\n" \ |
dialog "Please make sure that you have the virtualbox kernel module installed and loaded |
30 |
"Run 'virtualbox-config' to get the kernel module compiled and installed." |
Run 'virtualbox-config' to get the kernel module compiled and installed." |
31 |
fi |
fi |
32 |
|
|
33 |
echo -e ${COLRED}"Please make sure that you have the virtualbox kernel module installed and loaded."${COLDEFAULT} |
echo -e ${COLRED}"Please make sure that you have the virtualbox kernel module installed and loaded."${COLDEFAULT} |
36 |
fi |
fi |
37 |
|
|
38 |
# set lib dir |
# set lib dir |
39 |
export LD_LIBRARY_PATH="${INSTDIR}" |
export LD_LIBRARY_PATH="${INSTALL_DIR}" |
40 |
|
|
41 |
# check for the vbox XPCOM daemon |
# check for the vbox XPCOM daemon |
42 |
pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' ) |
pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' ) |
53 |
|
|
54 |
# start the daemon |
# start the daemon |
55 |
install -d ${VBOXCONFIG} |
install -d ${VBOXCONFIG} |
56 |
${INSTDIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1 |
${INSTALL_DIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1 |
57 |
|
|
58 |
# start the proper application |
# start the proper application |
59 |
case $(basename $0) in |
case $(basename $0) in |
60 |
virtualbox) |
virtualbox) |
61 |
exec ${INSTDIR}/VirtualBox $* |
exec ${INSTALL_DIR}/VirtualBox $* |
62 |
;; |
;; |
63 |
vboxmanage) |
vboxmanage) |
64 |
exec ${INSTDIR}/VBoxManage $* |
exec ${INSTALL_DIR}/VBoxManage $* |
65 |
;; |
;; |
66 |
vboxsdl) |
vboxsdl) |
67 |
exec ${INSTDIR}/VBoxSDL $* |
exec ${INSTALL_DIR}/VBoxSDL $* |
68 |
;; |
;; |
69 |
vboxbfe) |
vboxbfe) |
70 |
exec ${INSTDIR}/VBoxBFE $* |
exec ${INSTALL_DIR}/VBoxBFE $* |
71 |
|
;; |
72 |
|
vboxheadless|vboxvrdp) |
73 |
|
exec ${INSTALL_DIR}/VBoxHeadless $* |
74 |
|
;; |
75 |
|
vboxballoonctrl) |
76 |
|
exec ${INSTALL_DIR}/VBoxBalloonCtrl $* |
77 |
|
;; |
78 |
|
vboxautostart) |
79 |
|
exec ${INSTALL_DIR}/VBoxAutostart $* |
80 |
;; |
;; |
81 |
*) |
*) |
82 |
echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT} |
echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT} |