Skip to content

Commit

Permalink
add set_target_single function to only allow single jail targetting
Browse files Browse the repository at this point in the history
tschettervictor authored Dec 17, 2024
1 parent bff6b93 commit 1bcd44c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions usr/local/share/bastille/common.sh
Original file line number Diff line number Diff line change
@@ -73,12 +73,9 @@ warn() {
echo -e "${COLOR_YELLOW}$*${COLOR_RESET}"
}

# This is where I am placing all new functions.
check_target_exists() {
TARGET="${1}"
JAILS=""
local TARGET="${1}"
if [ -d "${bastille_jailsdir}"/"${TARGET}" ]; then
JAILS="${TARGET}"
return 0
else
error_exit "Jail not found."
@@ -95,6 +92,14 @@ check_target_is_running() {
set_target() {
if [ "${1}" = ALL ] || [ "${1}" = all ]; then
target_all_jails
else
TARGET="${1}"
fi
}

set_target_single() {
if [ "${1}" = ALL ] || [ "${1}" = all ]; then
error_exit "[all|ALL] not supported with this command."
else
TARGET="${1}"
check_target_exists "${TARGET}"

0 comments on commit 1bcd44c

Please sign in to comment.