a5b330652b
9-STABLE with "VBoxRT.so misses libiconv.so". While here pacify portlint by replacing a tab in the header with a single space. Approved by: decke
73 lines
1.2 KiB
Bash
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"
|