From 925cb895901c15cb7535b8f88fd270668c3d3321 Mon Sep 17 00:00:00 2001 From: foudil Date: Fri, 8 Nov 2024 17:38:48 +0100 Subject: [PATCH] Destroy release also destroys cached release --- docs/chapters/subcommands/destroy.rst | 6 +++--- docs/chapters/upgrading.rst | 2 -- usr/local/share/bastille/destroy.sh | 14 +++++--------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/chapters/subcommands/destroy.rst b/docs/chapters/subcommands/destroy.rst index d2a92228..0a5c4de1 100644 --- a/docs/chapters/subcommands/destroy.rst +++ b/docs/chapters/subcommands/destroy.rst @@ -18,10 +18,10 @@ created. Note: containers must be stopped before destroyed. Note: containers console logs not destroyed. /usr/local/bastille/logs/folsom_console.log -Release can be detroyed provided there are no child jails. The `force` option -deletes the release cache directory as well: +Releases can be detroyed which also deletes the related cache directory. Child +jails must be destroyed beforehand. .. code-block:: shell - ishmael ~ # bastille destroy force 14.0-RELEASE + ishmael ~ # bastille destroy 14.0-RELEASE Deleting base: 14.0-RELEASE diff --git a/docs/chapters/upgrading.rst b/docs/chapters/upgrading.rst index b059fa0d..a6318a98 100644 --- a/docs/chapters/upgrading.rst +++ b/docs/chapters/upgrading.rst @@ -39,5 +39,3 @@ After upgrading all jails from one release to the next you may find that you now `bastille list releases` to list all bootstrapped releases. `bastille destroy X.Y-RELEASE` to fully delete the release. - -`bastille destroy force X.Y-RELEASE` to delete the cache directory as well. diff --git a/usr/local/share/bastille/destroy.sh b/usr/local/share/bastille/destroy.sh index 2a660439..8ecd8a76 100644 --- a/usr/local/share/bastille/destroy.sh +++ b/usr/local/share/bastille/destroy.sh @@ -152,10 +152,8 @@ destroy_rel() { OPTIONS="-rf" fi zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/releases/${TARGET}" - if [ "${FORCE}" = "1" ]; then - if [ -d "${bastille_cachedir}/${TARGET}" ]; then - zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${TARGET}" - fi + if [ -d "${bastille_cachedir}/${TARGET}" ]; then + zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${TARGET}" fi fi fi @@ -169,11 +167,9 @@ destroy_rel() { rm -rf "${bastille_rel_base}" fi - if [ "${FORCE}" = "1" ]; then - ## remove cache on force - if [ -d "${bastille_cachedir}/${TARGET}" ]; then - rm -rf "${bastille_cachedir}/${TARGET}" - fi + ## remove cache + if [ -d "${bastille_cachedir}/${TARGET}" ]; then + rm -rf "${bastille_cachedir}/${TARGET}" fi echo else