#!/bin/sh
#
# $FreeBSD: net/openvswitch/files/ovs-vswitchd.in 300897 2012-07-14 14:29:18Z beat $
#

# PROVIDE: ovs_vswitchd
# REQUIRE: LOGIN ovsdb_server

. /etc/rc.subr

name="ovs_vswitchd"
rcvar=ovs_vswitchd_enable

command="/usr/local/sbin/ovs-vswitchd"
pidfile="/usr/local/var/run/ovs-vswitchd.pid"
start_precmd="ovs_vswitchd_precmd"

load_rc_config $name

: ${ovs_vswitchd_enable="NO"}
: ${ovsdb_server_sock="/usr/local/var/run/openvswitch/db.sock"}

ovs_vswitchd_precmd() {
	load_kld if_tap || return 1
}

command_args="--detach --pidfile=$pidfile unix:$ovsdb_server_sock"

run_rc_command "$1"
