#!/bin/sh

# $FreeBSD: $
#
# PROVIDE: bastille
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following to /etc/rc.conf[.local] to enable this service
#
# bastille_enable (bool):          Set to NO by default.
#               Set it to YES to enable bastille.
# bastille_list (string):        Set to "" by default.
#               Space separated list of jails to start.
#

. /etc/rc.subr

name=bastille
rcvar=${name}_enable

command="/usr/local/bin/${name}"

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

: ${bastille_enable:=NO}
: ${bastille_list:="ALL"}

bastille_start()
{
    for _jail in ${bastille_list}; do
        ${command} start ${_jail}
    done
}

bastille_stop()
{
    for _jail in ${bastille_list}; do
        ${command} stop ${_jail}
    done
}

load_rc_config ${name}
run_rc_command "$@"
