Merge pull request #987 from BastilleBSD/add-space-between-jails

add blank line after each jail on multiple targets
This commit is contained in:
tschettervictor
2025-04-29 18:55:29 -06:00
committed by GitHub
19 changed files with 60 additions and 7 deletions

View File

@@ -90,6 +90,7 @@ set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -115,6 +115,7 @@ check_fib() {
}
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -87,10 +87,15 @@ bastille_root_check
set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
host_path="${HOST_PATH}"
jail_path="$(echo ${bastille_jailsdir}/${_jail}/root/${JAIL_PATH} | sed 's#//#/#g')"
if ! cp "${OPTION}" "${host_path}" "${jail_path}"; then
error_continue "CP failed: ${host_path} -> ${jail_path}"
fi
done

View File

@@ -51,6 +51,8 @@ destroy_jail() {
local OPTIONS
for _jail in ${JAILS}; do
echo ""
bastille_jail_base="${bastille_jailsdir}/${_jail}"
bastille_jail_log="${bastille_logsdir}/${_jail}_console.log"

View File

@@ -85,6 +85,7 @@ bastille_root_check
set_target_single "${TARGET}"
info "[${TARGET}]:"
check_target_is_running "${TARGET}" || if [ "${AUTO}" -eq 1 ]; then
bastille start "${TARGET}"
else

View File

@@ -89,12 +89,17 @@ set_target_single "${SOURCE_TARGET}" && SOURCE_TARGET="${TARGET}"
set_target "${DEST_TARGET}" && DEST_TARGET="${JAILS}"
for _jail in ${DEST_TARGET}; do
if [ "${_jail}" = "${SOURCE_TARGET}" ]; then
continue
else
echo ""
info "[${_jail}]:"
source_path="$(echo ${bastille_jailsdir}/${SOURCE_TARGET}/root/${SOURCE_PATH} | sed 's#//#/#g')"
dest_path="$(echo ${bastille_jailsdir}/${_jail}/root/${DEST_PATH} | sed 's#//#/#g')"
if ! cp "${OPTION}" "${source_path}" "${dest_path}"; then
error_continue "JCP failed: ${source_path} -> ${dest_path}"
fi

View File

@@ -102,6 +102,7 @@ set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -142,6 +142,7 @@ fi
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -567,7 +567,7 @@ case "${ACTION}" in
add_interface "${TARGET}" "${INTERFACE}" "${IP}"
fi
if [ -n "${VLAN_ID}" ]; then
add_vlan "${TARGET}" "${INTERFACE}" "${IP}" "${VLAN_ID}"
add_vlan "${TARGET}" "${INTERFACE}" "${IP}" "${VLAN_ID}"
fi
if [ "${AUTO}" -eq 1 ]; then
bastille start "${TARGET}"

View File

@@ -96,6 +96,7 @@ errors=0
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -86,12 +86,17 @@ bastille_root_check
set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
bastille start "${_jail}"
else
error_notify "Jail is not running."
error_continue "Use [-a|--auto] to auto-start the jail."
fi
jexec -l "${_jail}" /usr/sbin/service "$@"
done

View File

@@ -111,7 +111,9 @@ for _jail in ${JAILS}; do
fi
fi
info "[${_jail}]:"
echo ""
info "[${_jail}]:"
check_target_is_stopped "${_jail}" || error_continue "Jail is already running."
# Validate interfaces and add IPs to firewall table

View File

@@ -86,7 +86,9 @@ set_target "${TARGET}" "reverse"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || error_continue "Jail is already stopped."
# Remove RDR rules

View File

@@ -86,12 +86,17 @@ bastille_root_check
set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
bastille start "${_jail}"
else
error_notify "Jail is not running."
error_continue "Use [-a|--auto] to auto-start the jail."
fi
jexec -l "${_jail}" /usr/sbin/sysrc "$@"
done

View File

@@ -75,6 +75,9 @@ bastille_root_check
set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
bastille_jail_tags="${bastille_jailsdir}/${_jail}/tags"
case ${ACTION} in
add)

View File

@@ -270,6 +270,7 @@ fi
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -85,10 +85,12 @@ bastille_root_check
set_target_single "${TARGET}"
info "[${TARGET}]:"
check_target_is_running "${TARGET}" || if [ "${AUTO}" -eq 1 ]; then
bastille start "${TARGET}"
else
error_notify "Jail is not running."
error_continue "Use [-a|--auto] to auto-start the jail."
fi
jexec -l "${TARGET}" /usr/bin/top

View File

@@ -87,6 +87,7 @@ set_target "${TARGET}"
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then

View File

@@ -45,43 +45,57 @@ EOF
zfs_snapshot() {
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
# shellcheck disable=SC2140
zfs snapshot -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"@"${TAG}"
echo
done
}
zfs_destroy_snapshot() {
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
# shellcheck disable=SC2140
zfs destroy -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"@"${TAG}"
echo
done
}
zfs_set_value() {
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
zfs "${ATTRIBUTE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
echo
done
}
zfs_get_value() {
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
zfs get "${ATTRIBUTE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
echo
done
}
zfs_disk_usage() {
for _jail in ${JAILS}; do
echo ""
info "[${_jail}]:"
zfs list -t all -o name,used,avail,refer,mountpoint,compress,ratio -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
echo
done
}