8 if [[ -n "$INSTALL_DIR" ]]; then
9 VBOXMANAGE
="$INSTALL_DIR/VBoxManage"
10 BUILDVBOXDRV
="$INSTALL_DIR/src/vboxhost/vboxdrv/build_in_tmp"
11 BUILDVBOXNETFLT
="$INSTALL_DIR/src/vboxhost/vboxnetflt/build_in_tmp"
12 BUILDVBOXNETADP
="$INSTALL_DIR/src/vboxhost/vboxnetadp/build_in_tmp"
14 echo "Missing /etc/vbox/vbox.cfg"
18 # detection of dkms (if not disabled)
19 if [[ "$DISABLE_DKMS" =~
[yY
][eE
][sS
] ]]; then
22 which dkms
&>/dev
/null
26 # STARTBUILD cannot be used with dkms
27 (( USE_DKMS
== 1 )) && START_BUILD
=no
31 if [[ "$START_BUILD" =~
[yY
][eE
][sS
] ]]; then
32 # check if module exists
33 c
=$
('find' "/lib/modules/$(uname -r)" -type f
-regex '.*/vbox\(drv\|netadp\|netflt\).ko' |
wc -l)
36 stat_busy
"Loading VirtualBox kernel modules"
38 for module
in vbox
{drv
,netadp
,netflt
}; do
39 modprobe
$module &>/dev
/null
42 for module
in vbox
{drv
,netadp
,netflt
}; do
43 if ! grep -q "^${module}" /proc
/modules
; then
53 stat_busy
"Unloading VirtualBox kernel modules"
55 for module
in vbox
{netflt
,netadp
,drv
}; do
56 if grep -q "^${module}" /proc
/modules
; then
57 modprobe
-r $module &>/dev
/null
61 for module
in vbox
{drv
,netadp
,netflt
}; do
62 if grep -q "^${module}" /proc
/modules
; then
72 if (( USE_DKMS
== 1 )); then
73 status
"Removing VirtualBox kernel modules with DKMS" dkms remove
-m vboxhost
-v "$INSTALL_VER" --all
75 stat_busy
"Removing VirtualBox kernel modules"
76 find "/lib/modules/$(uname -r)" -type f
-regex '.*/vbox\(drv\|netadp\|netflt\).ko' -delete
82 if (( USE_DKMS
== 1 )); then
83 status
"Adding VirtualBox kernel modules in DKMS" dkms add
-m vboxhost
-v "$INSTALL_VER"
84 status
"Bulding VirtualBox kernel modules with DKMS" dkms build
-m vboxhost
-v "$INSTALL_VER"
85 status
"Installing VirtualBox kernel modules with DKMS" dkms
install -m vboxhost
-v "$INSTALL_VER"
88 stat_busy
"Compiling VirtualBox kernel modules"
89 LOG
="/tmp/vbox-install.log"
91 --save-module-symvers /tmp
/vboxdrv-Module.symvers \
92 --no-print-directory install > $LOG 2>&1; then
93 echo "Look at $LOG to find out what went wrong"
95 if ! $BUILDVBOXNETFLT \
96 --use-module-symvers /tmp
/vboxdrv-Module.symvers \
97 --no-print-directory install >> $LOG 2>&1; then
98 echo "Look at $LOG to find out what went wrong"
100 if ! $BUILDVBOXNETADP \
101 --use-module-symvers /tmp
/vboxdrv-Module.symvers \
102 --no-print-directory install >> $LOG 2>&1; then
103 echo "Look at $LOG to find out what went wrong"
111 # Build our device tree
112 for i
in /sys
/bus
/usb
/devices
/*; do
113 if test -r "$i/dev"; then
114 dev
="`cat "$i/dev
" 2> /dev/null`"
115 major
="`expr "$dev" : '\(.*\):' 2> /dev/null`"
116 minor
="`expr "$dev" : '.*:\(.*\)' 2> /dev/null`"
117 class
="`cat $i/bDeviceClass 2> /dev/null`"
118 sh
"$INSTALL_DIR/VBoxCreateUSBNode.sh" "$major" "$minor" "$class" 2>/dev
/null
144 echo "usage: $0 {start|stop|restart|setup|remove|fixusb}"
147 # vim:set ts=2 sw=2 ft=sh et: