Files
BastilleBSD_bastille/usr/local/bin/bbsd-start

36 lines
780 B
Plaintext
Raw Normal View History

2018-04-06 13:40:48 -06:00
#!/bin/sh
# (christer.edwards@gmail.com)
# start jail
if [ $# -lt 1 ]; then
printf "Required: jail name(s)."
exit 1
fi
ARGS=$*
for jail in ${ARGS}; do
PREFIX=/usr/local
PLATFORM=${PREFIX}/bastille
JAIL_BASE=${PLATFORM}/jails/${jail}
JAIL_ROOT=${JAIL_BASE}/root
JAIL_CONF=${JAIL_BASE}/jail.conf
PKGS_CONF=${JAIL_BASE}/pkgs.conf
JAIL_JID=${JAIL_BASE}/${jail}.jid
err_msg() {
printf "ERROR:\t$@\n"
}
if [ ! -d ${JAIL_ROOT} ]; then
err_msg "Jail (${jail}) does not exist(?)."
elif [ -d ${JAIL_ROOT} ]; then
jail -c -f "${JAIL_CONF}" -J "${JAIL_JID}" ${jail}
pfctl -f /etc/pf.conf
#if [ -s ${PKGS_CONF} ]; then
# pkg -j ${jail} install -y $(cat ${PKGS_CONF})
#fi
fi
done