mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-21 09:41:47 +01:00
More validation/checks for export command
This commit is contained in:
@@ -60,11 +60,13 @@ fi
|
|||||||
SAFE_EXPORT=
|
SAFE_EXPORT=
|
||||||
RAW_EXPORT=
|
RAW_EXPORT=
|
||||||
DIR_EXPORT=
|
DIR_EXPORT=
|
||||||
|
TXZ_EXPORT=
|
||||||
|
|
||||||
# Handle and parse option args
|
# Handle and parse option args
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-t|--txz)
|
-t|--txz)
|
||||||
|
TXZ_EXPORT="1"
|
||||||
if [ "${bastille_zfs_enable}" = "YES" ]; then
|
if [ "${bastille_zfs_enable}" = "YES" ]; then
|
||||||
bastille_zfs_enable="NO"
|
bastille_zfs_enable="NO"
|
||||||
fi
|
fi
|
||||||
@@ -89,6 +91,17 @@ while [ $# -gt 0 ]; do
|
|||||||
esac
|
esac
|
||||||
done
|
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
|
# Export directory check
|
||||||
if [ -n "${DIR_EXPORT}" ]; then
|
if [ -n "${DIR_EXPORT}" ]; then
|
||||||
if [ -d "${DIR_EXPORT}" ]; then
|
if [ -d "${DIR_EXPORT}" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user