From bfa500a183f433088990e21ea2814d074e088361 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 4 Apr 2020 10:23:43 -0400 Subject: [PATCH] Always check if user specified path exist --- usr/local/share/bastille/export.sh | 10 +++++----- usr/local/share/bastille/import.sh | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index a044f9f5..4cd9f029 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -102,11 +102,11 @@ if echo "${TARGET}" | grep -q '\/'; then GETDIR="${TARGET}" TARGET=$(echo ${TARGET} | awk -F '\/' '{print $NF}') bastille_backupsdir=$(echo ${GETDIR} | sed "s/${TARGET}//") -else - # Check if backups directory/dataset exist - if [ ! -d "${bastille_backupsdir}" ]; then - error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}" - fi +fi + +# Check if backups directory/dataset exist +if [ ! -d "${bastille_backupsdir}" ]; then + error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}" fi # Check if is a ZFS system diff --git a/usr/local/share/bastille/import.sh b/usr/local/share/bastille/import.sh index 2d9077ea..f2290c3f 100644 --- a/usr/local/share/bastille/import.sh +++ b/usr/local/share/bastille/import.sh @@ -377,11 +377,11 @@ if echo "${TARGET}" | grep -q '\/'; then GETDIR="${TARGET}" TARGET=$(echo ${TARGET} | awk -F '\/' '{print $NF}') bastille_backupsdir=$(echo ${GETDIR} | sed "s/${TARGET}//") -else - # Check if backups directory/dataset exist - if [ ! -d "${bastille_backupsdir}" ]; then - error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}" - fi +fi + +# Check if backups directory/dataset exist +if [ ! -d "${bastille_backupsdir}" ]; then + error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}" fi # Check if archive exist then trim archive name