User option to force destroy jail in ZFS

This commit is contained in:
Jose
2020-05-22 21:46:03 -04:00
parent c98ea0a380
commit 147e7d5db3

View File

@@ -60,8 +60,12 @@ destroy_jail() {
if [ "${bastille_zfs_enable}" = "YES" ]; then
if [ -n "${bastille_zfs_zpool}" ]; then
if [ -n "${TARGET}" ]; then
local OPTIONS="-r"
if [ "${FORCE}" = "1" ]; then
local OPTIONS="-rf"
fi
## remove jail zfs dataset recursively
zfs destroy -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}"
zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${TARGET}"
fi
fi
fi