#!/bin/sh

# Bastille jail startup script
#
# PROVIDE: bastille
# REQUIRE: jail
# KEYWORD: shutdown

# Add the following to /etc/rc.conf[.local] to enable this service
#
# bastille_enable (bool):        Set to "NO" by default.
#                                Set to "YES" to enable bastille.
# bastille_conf (bool):          Set to "/usr/local/etc/bastille/bastille.conf" by default.
#                                Path to bastile.conf file.
# bastille_startup_delay (bool): Set to 0 by default.
#                                Set to a numerical value.
#                                This is the delay between startup of each jail.
#

. /etc/rc.subr

name=bastille
rcvar=${name}_enable

: ${bastille_enable:="NO"}
: ${bastille_conf:="/usr/local/etc/bastille/bastille.conf"}
: ${bastille_startup_delay:=0}

command=/usr/local/bin/${name}
start_cmd="bastille_start"
stop_cmd="bastille_stop"
restart_cmd="bastille_stop && bastille_start"

bastille_start()
{
    ${command} start --boot --delay ${bastille_startup_delay} ALL
}

bastille_stop()
{
   ${command} stop ALL
}

load_rc_config ${name}
run_rc_command "$1"
