Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update destroy.sh - refuse to destroy jail with mounted filesystem #749

Merged
merged 9 commits into from
Jan 6, 2025
6 changes: 6 additions & 0 deletions usr/local/share/bastille/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"/root/)
if [ -n "${mount_points}" ]; 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
Expand Down