#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: gocage
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable :
#
# gocage_enable="YES"
#
# gocage_conf="/usr/local/etc/gocage.conf.yml"
#

. /etc/rc.subr

name="gocage"
rcvar=gocage_enable

# read configuration and set defaults
load_rc_config "$name"

: ${gocage_enable:="NO"}
: ${gocage_conf="/usr/local/etc/gocage.conf.yml"}

start_cmd=${name}_start
stop_cmd=${name}_stop

gocage_start()
{
    echo "Gocage starting jails... "
    /usr/local/bin/gocage -c ${gocage_conf} start
}

gocage_stop()
{
    echo "Gocage stopping jails... "
    /usr/local/bin/gocage  -c ${gocage_conf} stop
}

run_rc_command "$1"
