freebsd-ports/emulators/virtualbox-ose-kmod-legacy/files/vboxnet.in
Bernhard Froehlich a60eaff53f - Update to virtualbox-ose 4.2.20_1
- This update pulls in many changes from the port and brings better support
for FreeBSD 10 and GCC from ports. I am doing that in preparation of the
upcoming VirtualBox 4.3 update that should land soon.
2013-12-13 11:17:19 +00:00

73 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: vboxnet
# REQUIRE: FILESYSTEMS NETWORKING ldconfig
# KEYWORD: nojail
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# vboxnet_enable (bool): Set to NO by default.
# Set it to YES to load network related kernel modules on startup
. /etc/rc.subr
name="vboxnet"
rcvar=vboxnet_enable
start_cmd="vboxnet_start"
stop_cmd="vboxnet_stop"
vboxnet_start()
{
if ! kldstat -q -m ng_vboxnetflt;
then
if ! kldload vboxnetflt > /dev/null 2>&1;
then
warn "Can't load vboxnetflt module."
return 1
fi
fi
if ! kldstat -q -m vboxnetadp;
then
if ! kldload vboxnetadp > /dev/null 2>&1;
then
warn "Can't load vboxnetadp module."
return 1
fi
fi
# initialize configured host-only interfaces
%%PREFIX%%/bin/VBoxManage list hostonlyifs >/dev/null
}
vboxnet_stop()
{
if kldstat -q -m vboxnetadp;
then
if ! kldunload vboxnetadp > /dev/null 2>&1;
then
warn "Can't unload vboxnetadp module."
return 1
fi
fi
if kldstat -q -m ng_vboxnetflt;
then
if ! kldunload vboxnetflt > /dev/null 2>&1;
then
warn "Can't unload vboxnetflt module."
return 1
fi
fi
}
load_rc_config $name
: ${vboxnet_enable="NO"}
run_rc_command "$1"