### BEGIN INIT INFO # Provides: vbox # Required-Start: $syslog $local_fs # Required-Stop: $syslog $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: The Virtual Box kernel module # Description: The Virtual Box kernel module ### END INIT INFO
running() { lsmod | grep -q "$1[^_-]" }
start() { echo $"Starting Virtual Box." if ! running vboxdrv; then if ! modprobe vboxdrv; then echo $"Failed." return 1 else chown root.vboxusers /dev/vboxdrv fi fi if ! running vboxnetadp; then if ! modprobe vboxnetadp; then echo $"Failed." return 1 else chown root.vboxusers /dev/vboxnetctl fi fi if ! running vboxnetflt; then if ! modprobe vboxnetflt; then echo $"Failed." return 1 fi fi
return 0 }
stop() { if running vboxnetadp; then if ! rmmod vboxnetadp; then echo $"Cannot unload module vboxnetadp" return 1 fi fi
if running vboxdrv; then if running vboxnetflt; then if ! rmmod vboxnetflt; then echo $"Cannot unload module vboxnetflt" return 1 fi fi if ! rmmod vboxdrv; then echo $"Cannot unload module vboxdrv" return 1 fi fi
return 0 }
status() { if running vboxdrv; then if running vboxnetflt; then if running vboxnetadp; then echo $"VirtualBox kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are loaded." else echo $"VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded." fi else echo $"VirtualBox kernel module is loaded." fi return 0 else echo $"VirtualBox kernel module is not loaded." return 3 fi }