#!/sbin/runscript # # OpenRC service for VirtualBox Guest. name="VirtualBox guest module (un)loader" depend() { provide virtualbox-guest need sysfs } start() { ebegin "Loading VirtualBox guest modules" for _mod_ in vboxguest vboxsf vboxvideo; do if grep -vq '^${_mod_}' /proc/modules; then modprobe -q ${_mod_} fi done eend $? } stop() { ebegin "Unloading VirtualBox guest modules" for _mod_ in vboxvideo vboxsf vboxguest; do if ! grep -q '^${_mod_}' /proc/modules; then modprobe -rq ${_mod_} fi done eend $? }