33 lines
526 B
Text
33 lines
526 B
Text
#!/sbin/runscript
|
|
#
|
|
# OpenRC service for VirtualBox.
|
|
|
|
name="VirtualBox module (un)loader"
|
|
|
|
depend()
|
|
{
|
|
provide virtualbox
|
|
need sysfs
|
|
}
|
|
|
|
start()
|
|
{
|
|
ebegin "Loading VirtualBox host modules"
|
|
for _mod_ in vboxdrv vboxnetadp vboxnetflt; do
|
|
if grep -vq '^${_mod_}' /proc/modules; then
|
|
modprobe -q ${_mod_}
|
|
fi
|
|
done
|
|
eend $?
|
|
}
|
|
|
|
stop()
|
|
{
|
|
ebegin "Unloading VirtualBox host modules"
|
|
for _mod_ in vboxnetflt vboxnetadp vboxdrv; do
|
|
if ! grep -q '^${_mod_}' /proc/modules; then
|
|
modprobe -rq ${_mod_}
|
|
fi
|
|
done
|
|
eend $?
|
|
}
|