diff --git a/usr/local/share/bastille/destroy.sh b/usr/local/share/bastille/destroy.sh index 9d9e9996..f3f0e3ec 100644 --- a/usr/local/share/bastille/destroy.sh +++ b/usr/local/share/bastille/destroy.sh @@ -54,6 +54,12 @@ destroy_jail() { fi if [ -d "${bastille_jail_base}" ]; then + ## make sure no filesystem is currently mounted in the jail directory + mount_points=$(mount | cut -d ' ' -f 3 | grep "${bastille_jail_base}") + if [ $? -eq 0 ]; then + error_notify "Failed to destroy jail: ${TARGET}" + error_exit "Jail has mounted filesystems:\n$mount_points" + fi info "Deleting Jail: ${TARGET}." if checkyesno bastille_zfs_enable; then if [ -n "${bastille_zfs_zpool}" ]; then