1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.1 2007-04-13 21:55:56 niro Exp $ |
# $Header: /root/magellan-cvs/src/virtualbox/virtualbox-wrapper.sh,v 1.5 2008-06-10 16:29:07 niro Exp $ |
3 |
# Wrapper for virtual for Magellan-Linux |
# Wrapper for virtual for Magellan-Linux |
4 |
|
|
5 |
LIBDIR=/usr/lib |
LIBDIR=/usr/lib |
8 |
VBOXCONFIG=$HOME/.VirtualBox |
VBOXCONFIG=$HOME/.VirtualBox |
9 |
VBOXLOG=${VBOXCONFIG}/log |
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 |
# check for the vbox module |
21 |
if [[ ! -w /dev/vboxdrv ]] |
if [[ ! -w /dev/vboxdrv ]] |
22 |
then |
then |
23 |
echo "Please make sure that you have the virtualbox kernel module installed and loaded." |
if [[ ! -z ${DISPLAY} ]] |
24 |
echo "Run 'virtualbox-config' to get the kernel module compiled and installed." |
then |
25 |
|
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 -; } |
27 |
|
[[ -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 |
30 |
|
Run 'virtualbox-config' to get the kernel module compiled and installed." |
31 |
|
fi |
32 |
|
|
33 |
|
echo -e ${COLRED}"Please make sure that you have the virtualbox kernel module installed and loaded."${COLDEFAULT} |
34 |
|
echo -e ${COLRED}"Run 'virtualbox-config' to get the kernel module compiled and installed."${COLDEFAULT} |
35 |
|
exit 1 |
36 |
fi |
fi |
37 |
|
|
38 |
# set lib dir |
# set lib 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 }' ) |
43 |
|
|
44 |
# kill all running instances for $USER |
# kill all running instances for $USER |
45 |
if [[ -n ${pid} ]] |
if [[ -n ${pid} ]] |
46 |
then |
then |
47 |
kill -TERM ${pid} |
kill -TERM ${pid} |
48 |
sleep 2 |
sleep 2 |
49 |
|
|
50 |
# kill the pidfile |
# kill the pidfile |
51 |
rm -rf /tmp/.vbox-$USER-ipc |
rm -rf /tmp/.vbox-$USER-ipc |
52 |
fi |
fi |
70 |
exec ${INSTDIR}/VBoxBFE $* |
exec ${INSTDIR}/VBoxBFE $* |
71 |
;; |
;; |
72 |
*) |
*) |
73 |
echo "Error: Unknown application - $(basename $0)" |
echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT} |
74 |
exit 1 |
exit 1 |
75 |
;; |
;; |
76 |
esac |
esac |