From 674e8ff087d1d360c77c248f688237e8f12ee404 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 18 Feb 2021 06:48:43 -0400 Subject: [PATCH] More validation/checks for export command --- usr/local/share/bastille/export.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index ed168512..9d935ccf 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -60,11 +60,13 @@ fi SAFE_EXPORT= RAW_EXPORT= DIR_EXPORT= +TXZ_EXPORT= # Handle and parse option args while [ $# -gt 0 ]; do case "${1}" in -t|--txz) + TXZ_EXPORT="1" if [ "${bastille_zfs_enable}" = "YES" ]; then bastille_zfs_enable="NO" fi @@ -89,6 +91,17 @@ while [ $# -gt 0 ]; do esac done +## validate for combined options +if [ -n "${TXZ_EXPORT}" ] && [ -n "${SAFE_EXPORT}" ]; then + error_exit "Error: Archive mode and Safe mode exports can't be used together." +fi +if [ -n "${SAFE_EXPORT}" ]; then + # Check if container is running, otherwise don't try to stop/start the jail + if [ -z "$(jls name | awk "/^${TARGET}$/")" ]; then + SAFE_EXPORT= + fi +fi + # Export directory check if [ -n "${DIR_EXPORT}" ]; then if [ -d "${DIR_EXPORT}" ]; then