Magellan Linux

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

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

revision 313 by niro, Sun Aug 19 03:05:05 2007 UTC revision 986 by niro, Fri Feb 19 12:38:29 2010 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.7 2007-08-19 03:05:05 niro Exp $  # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.11 2010-02-19 12:38:29 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    VBOXNETMODULE=vboxnetflt.ko
9    VBOXNETADPMODULE=vboxnetadp.ko
10    
11  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
12  COLGREEN="\033[1;6m\033[32m"  COLGREEN="\033[1;6m\033[32m"
# Line 44  then Line 46  then
46   die "No kernel sources for kernel ${KERNEL_VERSION} found! Aborting."   die "No kernel sources for kernel ${KERNEL_VERSION} found! Aborting."
47  fi  fi
48    
49  if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${VBOXMODULE} ]]  for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}
50  then  do
51   mecho "Removing old module ..."   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module} ]]
52   rm -f /lib/modules/${KERNEL_VERSION}/misc/${VBOXMODULE}   then
53  fi   mecho "Removing old ${module} module ..."
54     # try to unload the modules
55     if [[ -n $(grep "${module} " /proc/modules 2> /dev/null) ]]
56     then
57     modprobe -r ${module/.ko/}
58     fi
59     rm -f /lib/modules/${KERNEL_VERSION}/misc/${module}
60     fi
61    done
62    
63  # compile the module  for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}
64  cd ${INSTDIR}/src  do
65  make -C ${KERNEL_SOURCES} SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules || die "mod-compile"   # compile the module
66     cd ${INSTDIR}/src/${module/.ko/}
67  # install the module  
68  install -d /lib/modules/${KERNEL_VERSION}/misc   make -C ${KERNEL_SOURCES} SUBDIRS=$(pwd) SRCROOT=$(pwd) clean || die "mod-compile ${module}"
69  install -m0644 ${VBOXMODULE} /lib/modules/${KERNEL_VERSION}/misc || die "mod-install"  
70     # need some symver from vboxmodule (must be run after clean!)
71     if [[ ${module} = ${VBOXNETMODULE} ]] && [[ -f ../${VBOXMODULE/.ko/}/Module.symvers ]]
72     then
73     cp ../${VBOXMODULE/.ko/}/Module.symvers .
74     fi
75    
76     make -C ${KERNEL_SOURCES} SUBDIRS=$(pwd) SRCROOT=$(pwd) modules || die "mod-compile ${module}"
77    
78     # install the modules
79     install -d /lib/modules/${KERNEL_VERSION}/misc
80     install -m0644 ${module} /lib/modules/${KERNEL_VERSION}/misc || die "mod-install ${module}"
81    done
82    
83  # calc module dependencies  # calc module dependencies
84  mecho "Calculating module dependencies ..."  mecho "Calculating module dependencies ..."
85  depmod -ae ${KERNEL_VERSION}  depmod -ae ${KERNEL_VERSION}
86    
87  # re-read udev rules to grant the right permissions  # re-read udev rules to grant the right permissions
88  if [[ -x $(which udevcontrol) ]]  if [[ -x $(which udevadm) ]]
89  then  then
90   mecho "Reloading udev configuration ..."   mecho "Reloading udev configuration ..."
91   $(which udevcontrol) reload_rules   $(which udevadm) control --reload-rules
92  fi  fi
93    
94  # load the module  # load the module
95  if [[ x$(uname -r) = x${KERNEL_VERSION} ]]  if [[ x$(uname -r) = x${KERNEL_VERSION} ]]
96  then  then
97   mecho "Loading kernel-module ${VBOXMODULE} ..."   for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}
98   modprobe $(basename ${VBOXMODULE} .ko)   do
99     mecho "Loading kernel-module ${module} ..."
100     modprobe $(basename ${module} .ko)
101     done
102  else  else
103   echo -e ${COLRED}   echo -e ${COLRED}
104   echo "Your current running kernel does not match the the module target."   echo "Your current running kernel does not match the the module target."
105   echo "You must boot into your target kernel and load the module manually,"   echo "You must boot into your target kernel and load the modules manually,"
106   echo "before you can use virtual box."   echo "before you can use virtualbox."
107   echo -en ${COLDEFAULT}   echo -en ${COLDEFAULT}
108  fi  fi
109    

Legend:
Removed from v.313  
changed lines
  Added in v.986