Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 127 by niro, Fri Apr 13 22:51:43 2007 UTC revision 129 by niro, Sat Apr 14 14:10:48 2007 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.2 2007-04-13 22:51:43 niro Exp $  # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.3 2007-04-14 14:10:48 niro Exp $
3  # Configures virtualbox for Magellan-Linux  # Configures virtualbox for Magellan-Linux
4    
5  LIBDIR=/usr/lib  LIBDIR=/usr/lib
6  INSTDIR=${LIBDIR}/virtualbox  INSTDIR=${LIBDIR}/virtualbox
7  VBOXMODULE=vboxdrv.ko  VBOXMODULE=vboxdrv.ko
8    
9  if [[ $(id -u) != 0 ]]  COLRED="\033[1;6m\033[31m"
10    COLGREEN="\033[1;6m\033[32m"
11    COLDEFAULT="\033[0m"
12    
13    if [[ ${NOCOLORS} = true ]]
14  then  then
15   echo "You must be r00t!"   COLRED=""
16   exit 1   COLGREEN=""
17     COLDEFAULT=""
18  fi  fi
19    
20  echo "Running $(basename $0) for kernelversion $(uname -r) ..."  die() { echo -e "${COLRED}$@${COLDEFAULT}"; exit 1; }
21    mecho() { echo -e "${COLGREEN}$@${COLDEFAULT}"; }
22    
23    # must be root
24    [[ $(id -u) != 0 ]] && die "You must be r00t!"
25    
26    mecho "Running $(basename $0) for kernelversion $(uname -r) ..."
27    
28  if [ ! -f /lib/modules/$(uname -r)/source/include/linux/version.h ]  if [ ! -f /lib/modules/$(uname -r)/source/include/linux/version.h ]
29  then  then
30   echo "No includes for $(uname -r) found! Aborting."   die "No kernel headers for $(uname -r) found! Aborting."
  exit 1  
31  fi  fi
32    
33  if [[ -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} ]]  if [[ -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} ]]
34  then  then
35   echo "Removing old module ..."   mecho "Removing old module ..."
36   rm -f /lib/modules/$(uname -r)/misc/${VBOXMODULE}   rm -f /lib/modules/$(uname -r)/misc/${VBOXMODULE}
37  fi  fi
38    
39  # compile the module  # compile the module
40  cd ${INSTDIR}/src  cd ${INSTDIR}/src
41  make -C /lib/modules/$(uname -r)/source SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules  make -C /lib/modules/$(uname -r)/source SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules || die "mod-compile"
42    
43  # install the module  # install the module
44  install -d /lib/modules/$(uname -r)/misc  install -d /lib/modules/$(uname -r)/misc
45  install -m0644 ${VBOXMODULE} /lib/modules/$(uname -r)/misc  install -m0644 ${VBOXMODULE} /lib/modules/$(uname -r)/misc || die "mod-install"
46    
47  # calc module dependencies  # calc module dependencies
48    mecho "Calculating module dependencies ..."
49  depmod -ae  depmod -ae
50    
51    # re-read udev rules to grant the right permissions
52    if [[ -x $(which udevcontrol) ]]
53    then
54     mecho "Reloading udev configuration ..."
55     $(which udevcontrol) reload_config
56    fi
57    
58  # load the module  # load the module
59  echo "Loading module ${VBOXMODULE} ..."  mecho "Loading kernel-module ${VBOXMODULE} ..."
60  modprobe $(basename ${VBOXMODULE} .ko)  modprobe $(basename ${VBOXMODULE} .ko)
61    
62  echo  echo
63  echo "Virtualbox is now configured for your system."  mecho "Virtualbox is now configured for your system."
64  echo "Do not forget to add you users to the 'virtualbox' group."  mecho "Do not forget to add you users to the 'virtualbox' group."
65  echo  echo
66    
67  exit 0  exit 0

Legend:
Removed from v.127  
changed lines
  Added in v.129