Code cleanup, don't delete snapshot recursively
This commit is contained in:
@@ -159,11 +159,11 @@ clone_jail() {
|
|||||||
if ! [ -d "${bastille_jailsdir}/${NEWNAME}" ]; then
|
if ! [ -d "${bastille_jailsdir}/${NEWNAME}" ]; then
|
||||||
if [ "${bastille_zfs_enable}" = "YES" ]; then
|
if [ "${bastille_zfs_enable}" = "YES" ]; then
|
||||||
if [ -n "${bastille_zfs_zpool}" ]; then
|
if [ -n "${bastille_zfs_zpool}" ]; then
|
||||||
# Rename ZFS dataset and mount points accordingly
|
# Replicate the existing container
|
||||||
DATE=$(date +%F-%H%M%S)
|
DATE=$(date +%F-%H%M%S)
|
||||||
zfs snapshot -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}"
|
zfs snapshot -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}"
|
||||||
zfs send -R "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}" | zfs recv "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NEWNAME}"
|
zfs send -R "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}" | zfs recv "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NEWNAME}"
|
||||||
zfs destroy -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}"
|
zfs destroy "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}@bastille_clone_${DATE}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Just clone the jail directory
|
# Just clone the jail directory
|
||||||
|
|||||||
Reference in New Issue
Block a user