ports/sysutils/cbsd/files/cbsdd.in
Veniamin Gvozdikov 5989861156 - Update to 10.0.3
PR:		ports/186864
Submitted by:	Oleg Ginzburg <olevole@olevole.ru> (maintainer)
2014-02-22 19:45:34 +00:00

75 lines
1.3 KiB
Bash

#!/bin/sh
#
# PROVIDE: cbsdd
# REQUIRE: LOGIN FILESYSTEMS sshd
# KEYWORD: shutdown
#
# cbsdd_enable="YES"
#
. /etc/rc.subr
name=cbsdd
rcvar=cbsdd_enable
load_rc_config $name
: ${cbsdd_enable="NO"}
export workdir="${cbsd_workdir}"
globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"}
if [ ! -f ${globalconf} ]; then
echo "cbsd: no such ${globalconf}";
exit 1
fi
if [ ! -f ${inventory} ]; then
echo "cbsd: no such ${inventory}";
exit 1
fi
if [ ! -f ${mdtools} ]; then
echo "cbsd: no such ${mdtools}";
exit 1
fi
if [ ! -f ${subr} ]; then
echo "cbsd: no such ${subr}";
exit 1
fi
if [ ! -f ${localcbsdconf} ]; then
echo "cbsd: no such ${localcbsdconf}";
exit 1
fi
. ${globalconf}
. ${inventory}
. ${mdtools}
. ${subr}
. ${localcbsdconf}
start_precmd=${name}_prestart
stop_precmd=${name}_prestop
command="${sbindir}/cbsdd"
pidfile="/var/run/$name.pid"
cbsdd_prestart() {
find ${ftmpdir} -depth 1 -maxdepth 1 -type f -exec rm -f {} \;
%%PREFIX%%/bin/cbsd sysinv mode=update
. ${inventory}
[ -n "$nat_enable" ] && %%PREFIX%%/bin/cbsd naton
/usr/sbin/daemon ${rcddir}/jails-astart start
}
cbsdd_prestop()
{
${rcddir}/jails-astart stop
[ -n "${nat_enable}" ] && %%PREFIX%%/bin/cbsd natoff
}
run_rc_command "$1"