Merge pull request #267 from JRGTH/master
Option to create standard backups on ZFS setups
This commit is contained in:
@@ -120,7 +120,7 @@ update_jailconf_vnet() {
|
|||||||
|
|
||||||
# If 0.0.0.0 set DHCP, else set static IP address
|
# If 0.0.0.0 set DHCP, else set static IP address
|
||||||
if [ "${IP}" == "0.0.0.0" ]; then
|
if [ "${IP}" == "0.0.0.0" ]; then
|
||||||
sysrc -f "${bastille_jail_rc_conf}" ifconfig_vnet0="DHCP"
|
sysrc -f "${bastille_jail_rc_conf}" ifconfig_vnet0="SYNCDHCP"
|
||||||
else
|
else
|
||||||
sysrc -f "${bastille_jail_rc_conf}" ifconfig_vnet0="inet ${IP}"
|
sysrc -f "${bastille_jail_rc_conf}" ifconfig_vnet0="inet ${IP}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
. /usr/local/etc/bastille/bastille.conf
|
. /usr/local/etc/bastille/bastille.conf
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
error_exit "Usage: bastille export TARGET"
|
error_exit "Usage: bastille export TARGET [option] | PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle special-case commands first
|
# Handle special-case commands first
|
||||||
@@ -42,10 +42,47 @@ help|-h|--help)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ $# -ne 0 ]; then
|
# Check for unsupported actions
|
||||||
|
if [ "${TARGET}" = "ALL" ]; then
|
||||||
|
error_exit "Batch export is unsupported."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 2 ] || [ $# -lt 0 ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OPTION="${1}"
|
||||||
|
EXPATH="${2}"
|
||||||
|
|
||||||
|
# Handle some options
|
||||||
|
if [ -n "${OPTION}" ]; then
|
||||||
|
if [ "${OPTION}" = "-t" -o "${OPTION}" = "--txz" ]; then
|
||||||
|
if [ "${bastille_zfs_enable}" = "YES" ]; then
|
||||||
|
# Temporarily disable ZFS so we can create a standard backup archive
|
||||||
|
bastille_zfs_enable="NO"
|
||||||
|
fi
|
||||||
|
elif echo "${OPTION}" | grep -q "\/"; then
|
||||||
|
if [ -d "${OPTION}" ]; then
|
||||||
|
EXPATH="${OPTION}"
|
||||||
|
else
|
||||||
|
error_exit "Error: Path not found."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
error_notify "Invalid option!"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Export directory check
|
||||||
|
if [ -n "${EXPATH}" ]; then
|
||||||
|
if [ -d "${EXPATH}" ]; then
|
||||||
|
# Set the user defined export directory
|
||||||
|
bastille_backupsdir="${EXPATH}"
|
||||||
|
else
|
||||||
|
error_exit "Error: Path not found."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
jail_export()
|
jail_export()
|
||||||
{
|
{
|
||||||
# Attempt to export the container
|
# Attempt to export the container
|
||||||
@@ -82,13 +119,6 @@ jail_export()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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}//")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if backups directory/dataset exist
|
# Check if backups directory/dataset exist
|
||||||
if [ ! -d "${bastille_backupsdir}" ]; then
|
if [ ! -d "${bastille_backupsdir}" ]; then
|
||||||
error_exit "Backups directory/dataset does not exist. See 'bastille bootstrap'."
|
error_exit "Backups directory/dataset does not exist. See 'bastille bootstrap'."
|
||||||
|
|||||||
Reference in New Issue
Block a user