mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-18 16:21:32 +01:00
common: Do not target tags if jail exists with same name
This commit is contained in:
@@ -239,9 +239,7 @@ set_target() {
|
|||||||
target_all_jails
|
target_all_jails
|
||||||
else
|
else
|
||||||
for _jail in ${_TARGET}; do
|
for _jail in ${_TARGET}; do
|
||||||
if grep -Eohw "${_jail}" "${bastille_jailsdir}/*/tags"; then
|
if [ ! -d "${bastille_jailsdir}/${_TARGET}" ] && echo "${_jail}" | grep -Eq '^[0-9]+$'; then
|
||||||
_jail="$(bastille tags ALL list ${_jail} | tr '\n' ' ')"
|
|
||||||
elif [ ! -d "${bastille_jailsdir}/${_TARGET}" ] && echo "${_jail}" | grep -Eq '^[0-9]+$'; then
|
|
||||||
if get_jail_name "${_jail}" > /dev/null; then
|
if get_jail_name "${_jail}" > /dev/null; then
|
||||||
_jail="$(get_jail_name ${_jail})"
|
_jail="$(get_jail_name ${_jail})"
|
||||||
else
|
else
|
||||||
@@ -251,7 +249,11 @@ set_target() {
|
|||||||
if jail_autocomplete "${_jail}" > /dev/null; then
|
if jail_autocomplete "${_jail}" > /dev/null; then
|
||||||
_jail="$(jail_autocomplete ${_jail})"
|
_jail="$(jail_autocomplete ${_jail})"
|
||||||
elif [ $? -eq 2 ]; then
|
elif [ $? -eq 2 ]; then
|
||||||
|
if grep -Ehoqw ${_jail} ${bastille_jailsdir}/*/tags; then
|
||||||
|
_jail="$(grep -Eow ${_jail} ${bastille_jailsdir}/*/tags | awk -F"/tags" '{print $1}' | sed "s#${bastille_jailsdir}/##g" | tr '\n' ' ')"
|
||||||
|
else
|
||||||
error_continue "Jail not found \"${_jail}\""
|
error_continue "Jail not found \"${_jail}\""
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user