Contents of /trunk/virtualbox/virtualbox-config.sh
Parent Directory | Revision Log
Revision 129 -
(show annotations)
(download)
(as text)
Sat Apr 14 14:10:48 2007 UTC (17 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1686 byte(s)
Sat Apr 14 14:10:48 2007 UTC (17 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1686 byte(s)
- colored messages - reload udev_configuration
1 | #!/bin/bash |
2 | # $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 |
4 | |
5 | LIBDIR=/usr/lib |
6 | INSTDIR=${LIBDIR}/virtualbox |
7 | VBOXMODULE=vboxdrv.ko |
8 | |
9 | COLRED="\033[1;6m\033[31m" |
10 | COLGREEN="\033[1;6m\033[32m" |
11 | COLDEFAULT="\033[0m" |
12 | |
13 | if [[ ${NOCOLORS} = true ]] |
14 | then |
15 | COLRED="" |
16 | COLGREEN="" |
17 | COLDEFAULT="" |
18 | fi |
19 | |
20 | 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 ] |
29 | then |
30 | die "No kernel headers for $(uname -r) found! Aborting." |
31 | fi |
32 | |
33 | if [[ -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} ]] |
34 | then |
35 | mecho "Removing old module ..." |
36 | rm -f /lib/modules/$(uname -r)/misc/${VBOXMODULE} |
37 | fi |
38 | |
39 | # compile the module |
40 | cd ${INSTDIR}/src |
41 | make -C /lib/modules/$(uname -r)/source SUBDIRS=$(pwd) SRCROOT=$(pwd) clean modules || die "mod-compile" |
42 | |
43 | # install the module |
44 | install -d /lib/modules/$(uname -r)/misc |
45 | install -m0644 ${VBOXMODULE} /lib/modules/$(uname -r)/misc || die "mod-install" |
46 | |
47 | # calc module dependencies |
48 | mecho "Calculating module dependencies ..." |
49 | 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 |
59 | mecho "Loading kernel-module ${VBOXMODULE} ..." |
60 | modprobe $(basename ${VBOXMODULE} .ko) |
61 | |
62 | echo |
63 | mecho "Virtualbox is now configured for your system." |
64 | mecho "Do not forget to add you users to the 'virtualbox' group." |
65 | echo |
66 | |
67 | exit 0 |