Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 127 - (hide annotations) (download) (as text)
Fri Apr 13 22:51:43 2007 UTC (17 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1163 byte(s)
-check for r00t

1 niro 126 #!/bin/bash
2 niro 127 # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.2 2007-04-13 22:51:43 niro Exp $
3 niro 126 # Configures virtualbox for Magellan-Linux
4    
5     LIBDIR=/usr/lib
6     INSTDIR=${LIBDIR}/virtualbox
7     VBOXMODULE=vboxdrv.ko
8    
9 niro 127 if [[ $(id -u) != 0 ]]
10     then
11     echo "You must be r00t!"
12     exit 1
13     fi
14    
15 niro 126 echo "Running $(basename $0) for kernelversion $(uname -r) ..."
16    
17     if [ ! -f /lib/modules/$(uname -r)/source/include/linux/version.h ]
18     then
19     echo "No includes for $(uname -r) found! Aborting."
20     exit 1
21     fi
22    
23     if [[ -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} ]]
24     then
25     echo "Removing old module ..."
26     rm -f /lib/modules/$(uname -r)/misc/${VBOXMODULE}
27     fi
28    
29     # compile the module
30     cd ${INSTDIR}/src
31     make -C /lib/modules/$(uname -r)/source SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules
32    
33     # install the module
34     install -d /lib/modules/$(uname -r)/misc
35     install -m0644 ${VBOXMODULE} /lib/modules/$(uname -r)/misc
36    
37     # calc module dependencies
38     depmod -ae
39    
40     # load the module
41     echo "Loading module ${VBOXMODULE} ..."
42     modprobe $(basename ${VBOXMODULE} .ko)
43    
44     echo
45     echo "Virtualbox is now configured for your system."
46     echo "Do not forget to add you users to the 'virtualbox' group."
47     echo
48    
49     exit 0