Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1673 - (hide annotations) (download) (as text)
Sat Mar 3 03:48:52 2012 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1923 byte(s)
-get INSTALL_DIR from vbox.cfg
1 niro 126 #!/bin/bash
2 niro 1673 # $Id$
3 niro 126 # Wrapper for virtual for Magellan-Linux
4    
5 niro 1673 source /etc/vbox/vbox.cfg
6    
7 niro 126 XPCOM_DAEMON=VBoxSVC
8     VBOXCONFIG=$HOME/.VirtualBox
9     VBOXLOG=${VBOXCONFIG}/log
10    
11 niro 130 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 niro 126 # check for the vbox module
21     if [[ ! -w /dev/vboxdrv ]]
22     then
23 niro 552 if [[ ! -z ${DISPLAY} ]]
24     then
25 niro 649 dialog() { xterm -T "VirtualBox" -e "echo -e \"$@\"; echo; echo \"Press [Enter] to continue ...\"; read"; }
26 niro 552 [[ -x /usr/bin/xmessage ]] && dialog() { echo -e "$@" | /usr/bin/xmessage -center -button cancel -file -; }
27 niro 649 [[ -x /usr/bin/Xdialog ]] && dialog() { /usr/bin/Xdialog --no-ok --center --infobox "$@" 0 0; }
28 niro 552
29 niro 649 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 niro 552 fi
32    
33 niro 130 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 niro 128 exit 1
36 niro 126 fi
37    
38     # set lib dir
39 niro 1673 export LD_LIBRARY_PATH="${INSTALL_DIR}"
40 niro 126
41     # check for the vbox XPCOM daemon
42     pid=$( ps -U $USER | grep ${XPCOM_DAEMON} | awk '{ print $1 }' )
43 niro 128
44 niro 126 # kill all running instances for $USER
45     if [[ -n ${pid} ]]
46     then
47     kill -TERM ${pid}
48     sleep 2
49 niro 128
50 niro 126 # kill the pidfile
51     rm -rf /tmp/.vbox-$USER-ipc
52     fi
53    
54     # start the daemon
55     install -d ${VBOXCONFIG}
56 niro 1673 ${INSTALL_DIR}/${XPCOM_DAEMON} --daemonize > ${VBOXLOG} 2>&1
57 niro 126
58     # start the proper application
59     case $(basename $0) in
60     virtualbox)
61 niro 1673 exec ${INSTALL_DIR}/VirtualBox $*
62 niro 126 ;;
63     vboxmanage)
64 niro 1673 exec ${INSTALL_DIR}/VBoxManage $*
65 niro 126 ;;
66     vboxsdl)
67 niro 1673 exec ${INSTALL_DIR}/VBoxSDL $*
68 niro 126 ;;
69     vboxbfe)
70 niro 1673 exec ${INSTALL_DIR}/VBoxBFE $*
71 niro 126 ;;
72 niro 859 vboxheadless|vboxvrdp)
73 niro 1673 exec ${INSTALL_DIR}/VBoxHeadless $*
74 niro 676 ;;
75 niro 126 *)
76 niro 130 echo -e ${COLRED}"Error: Unknown application - $(basename $0)"${COLDEFAULT}
77 niro 126 exit 1
78     ;;
79     esac