#!/bin/bash # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.3 2007-04-14 14:10:48 niro Exp $ # Configures virtualbox for Magellan-Linux LIBDIR=/usr/lib INSTDIR=${LIBDIR}/virtualbox VBOXMODULE=vboxdrv.ko COLRED="\033[1;6m\033[31m" COLGREEN="\033[1;6m\033[32m" COLDEFAULT="\033[0m" if [[ ${NOCOLORS} = true ]] then COLRED="" COLGREEN="" COLDEFAULT="" fi die() { echo -e "${COLRED}$@${COLDEFAULT}"; exit 1; } mecho() { echo -e "${COLGREEN}$@${COLDEFAULT}"; } # must be root [[ $(id -u) != 0 ]] && die "You must be r00t!" mecho "Running $(basename $0) for kernelversion $(uname -r) ..." if [ ! -f /lib/modules/$(uname -r)/source/include/linux/version.h ] then die "No kernel headers for $(uname -r) found! Aborting." fi if [[ -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} ]] then mecho "Removing old module ..." rm -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} fi # compile the module cd ${INSTDIR}/src make -C /lib/modules/$(uname -r)/source SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules || die "mod-compile" # install the module install -d /lib/modules/$(uname -r)/misc install -m0644 ${VBOXMODULE} /lib/modules/$(uname -r)/misc || die "mod-install" # calc module dependencies mecho "Calculating module dependencies ..." depmod -ae # re-read udev rules to grant the right permissions if [[ -x $(which udevcontrol) ]] then mecho "Reloading udev configuration ..." $(which udevcontrol) reload_config fi # load the module mecho "Loading kernel-module ${VBOXMODULE} ..." modprobe $(basename ${VBOXMODULE} .ko) echo mecho "Virtualbox is now configured for your system." mecho "Do not forget to add you users to the 'virtualbox' group." echo exit 0