b6ffabc0e4
Big thanks to Ed Maste for making this happen.
40 lines
985 B
Bash
40 lines
985 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: ovsdb_server
|
|
# REQUIRE: LOGIN
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="ovsdb_server"
|
|
rcvar=ovsdb_server_enable
|
|
|
|
command="%%PREFIX%%/sbin/ovsdb-server"
|
|
pidfile="%%PREFIX%%/var/run/ovsdb-server.pid"
|
|
start_precmd="ovsdb_server_precmd"
|
|
|
|
load_rc_config $name
|
|
|
|
: ${ovsdb_server_enable="NO"}
|
|
: ${ovsdb_server_sock="%%PREFIX%%/var/run/openvswitch/db.sock"}
|
|
: ${ovsdb_server_database="%%PREFIX%%/etc/openvswitch/conf.db"}
|
|
|
|
ovsdb_server_precmd() {
|
|
[ -e "`dirname $ovsdb_server_database`" ] || \
|
|
mkdir -p "`dirname $ovsdb_server_database`"
|
|
[ -e "$ovsdb_server_database" ] || \
|
|
%%PREFIX%%/bin/ovsdb-tool create "$ovsdb_server_database" \
|
|
%%PREFIX%%/share/openvswitch/vswitch.ovsschema
|
|
}
|
|
|
|
command_args="--detach --pidfile=$pidfile \
|
|
--remote=punix:$ovsdb_server_sock \
|
|
--remote=db:Open_vSwitch,manager_options \
|
|
--private-key=db:SSL,private_key \
|
|
--certificate=db:SSL,certificate \
|
|
--bootstrap-ca-cert=db:SSL,ca_cert \
|
|
$ovsdb_server_database"
|
|
|
|
run_rc_command "$1"
|