From a60f76b3b664f26ccea12f8a8702bb958317c62e Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Tue, 6 May 2025 15:18:43 -0600 Subject: [PATCH] import: Fix TARGET_TRIM var --- usr/local/share/bastille/import.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usr/local/share/bastille/import.sh b/usr/local/share/bastille/import.sh index 3affc7da..b0824379 100644 --- a/usr/local/share/bastille/import.sh +++ b/usr/local/share/bastille/import.sh @@ -715,9 +715,8 @@ jail_import() { # Check for user specified file location if echo "${TARGET}" | grep -q '\/'; then - GETDIR="${TARGET}" - TARGET=$(echo ${TARGET} | awk -F '\/' '{print $NF}') - bastille_backupsdir=$(echo ${GETDIR} | sed "s/${TARGET}//") + TARGET="$(basename ${TARGET})" + bastille_backupsdir="$(dirname ${TARGET})" fi # Check if backups directory/dataset exist @@ -746,11 +745,11 @@ else fi # Check if a running jail matches name or already exist -if check_target_exists "${TARGET}"; then - error_exit "[ERROR]: Jail: ${TARGET} already exists." +if check_target_exists "${TARGET_TRIM}"; then + error_exit "[ERROR]: Jail: ${TARGET_TRIM} already exists." fi if [ -n "${TARGET}" ]; then - info "\nAttempting to import jail: ${TARGET}..." + info "\nAttempting to import jail: ${TARGET_TRIM}..." jail_import fi