mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-22 18:21:53 +01:00
Don't delete jail content on error, cleanup
Don't delete jail content on busy datasets by default, cleanup.
This commit is contained in:
@@ -77,8 +77,12 @@ destroy_jail() {
|
|||||||
if [ "${FORCE}" = "1" ]; then
|
if [ "${FORCE}" = "1" ]; then
|
||||||
OPTIONS="-rf"
|
OPTIONS="-rf"
|
||||||
fi
|
fi
|
||||||
## remove jail zfs dataset recursively
|
# Remove jail zfs dataset recursively, or abort if error thus precerving jail content.
|
||||||
zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
|
# This will deal with the common "cannot unmount 'XYZ': pool or dataset is busy"
|
||||||
|
# unless the force option is defined by the user, otherwise will have a partially deleted jail.
|
||||||
|
if ! zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"; then
|
||||||
|
error_exit "Jail dataset(s) appears to be busy, exiting."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -198,9 +202,9 @@ destroy_rel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Handle options.
|
# Handle options.
|
||||||
AUTO=0
|
AUTO="0"
|
||||||
FORCE=0
|
FORCE="0"
|
||||||
NO_CACHE=0
|
NO_CACHE="0"
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-h|--help|help)
|
-h|--help|help)
|
||||||
|
|||||||
Reference in New Issue
Block a user