updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / virtualbox-sun / etc_rc.d_vboxdrv
blob2df2fb6a06b35dd7f0c45dccb99ac9b9ff85b3dd
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/vboxdrv
7 case "$1" in
8 start)
9 stat_busy "Loading modules for VirtualBox"
10 for module in "${MODULES[@]}"; do
11 if [ "$module" = "${module#!}" ]; then
12 modprobe -q $module >/dev/null 2>&1
13 grep -q ^$module /proc/modules
14 if [ $? -ne 0 ]; then
15 res=$?; break
18 done
19 if [ -n "$res" ]; then
20 stat_fail
21 printhl "Try running '$0 setup', of course without quotes"
22 else
23 add_daemon vboxdrv
24 stat_done
27 stop)
28 stat_busy "Unloading modules for VirtualBox"
29 for module in "${MODULES[@]}"; do
30 if [ "$module" = "${module#!}" ]; then
31 REVERSE="$module $REVERSE"
33 done
34 if modprobe -q -r $REVERSE >/dev/null 2>&1; then
35 rm_daemon vboxdrv
36 stat_done
37 else
38 stat_fail
41 restart)
42 $0 stop
43 $0 start
45 setup)
46 if [ -x /etc/rc.d/dkms_autoinstaller ]; then
47 dkms add -m vboxhost -v $VBOX_VERSION >/dev/null 2>&1
48 exec /etc/rc.d/dkms_autoinstaller start
49 else
50 stat_busy "Building/installing vbox modules for `uname -srm`"
51 . /etc/vbox.cfg
52 cd "/usr/src/vboxhost-$VBOX_VERSION"
53 SETUP_LOG='/var/log/vboxdrv-setup.log'
54 make >${SETUP_LOG} 2>&1 && make install >>${SETUP_LOG} 2>&1; RET=$?; make clean >/dev/null 2>&1
55 if [ "$RET" -eq 0 ]; then
56 stat_done
57 else
58 stat_fail
59 printhl "See '${SETUP_LOG}' for further details"
64 echo "usage: $0 {start|stop|restart|setup}"
65 esac
66 # vim:set ts=4 sw=4 et: