Skip to content

Commit

Permalink
add check_target_exists to common.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
tschettervictor authored Dec 27, 2024
1 parent 5f8c79d commit 3dce542
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion usr/local/share/bastille/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ warn() {
echo -e "${COLOR_YELLOW}$*${COLOR_RESET}"
}

check_target_exists() {
local _TARGET="${1}"
if [ ! -d "${bastille_jailsdir}"/"${_TARGET}" ]; then
return 1
else
return 0
fi
}

generate_static_mac() {
local jail_name="${1}"
local external_interface="${2}"
Expand Down Expand Up @@ -143,7 +152,7 @@ set_target() {
if [ "${_TARGET}" = ALL ] || [ "${_TARGET}" = all ]; then
target_all_jails
else
check_target_exists "${_TARGET}" || exit
check_target_exists "${_TARGET}" || error_exit "Jail not found \"${_TARGET}\""
JAILS="${_TARGET}"
TARGET="${_TARGET}"
export JAILS
Expand Down

0 comments on commit 3dce542

Please sign in to comment.