From 1bcd44cbb38f64cdee87cad56a034d1b8075bd05 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:16:49 -0700 Subject: [PATCH] add set_target_single function to only allow single jail targetting --- usr/local/share/bastille/common.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index c8d1b621..da92ff5a 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -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}"