fix(uninstall): delete installer directory on --purge-data
--purge-data now removes /opt/triton-manage-server entirely (volumes, .env, and installer files). Without --purge-data the directory is kept so secrets in .env survive a reinstall. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9d0a608c19
commit
a8dcbe9b31
1 changed files with 9 additions and 5 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# uninstall.sh — stop and remove Manage Server containers.
|
# uninstall.sh — stop and remove Manage Server containers.
|
||||||
#
|
#
|
||||||
# By default, KEEPS the PostgreSQL volume (scan history, hosts, users).
|
# By default, KEEPS the PostgreSQL volume (scan history, hosts, users)
|
||||||
# Pass --purge-data to delete the volumes as well — irreversible.
|
# and the installer directory (preserves .env secrets for reinstall).
|
||||||
|
# Pass --purge-data to delete volumes + installer directory — irreversible.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# sudo bash uninstall.sh # stop + remove containers, keep DB
|
# sudo bash uninstall.sh # stop + remove containers, keep DB + .env
|
||||||
# sudo bash uninstall.sh --purge-data # also delete DB + binaries volume
|
# sudo bash uninstall.sh --purge-data # also delete DB, volumes, and /opt/triton-manage-server
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||||
|
|
@ -48,9 +49,12 @@ if [[ $PURGE -eq 1 ]]; then
|
||||||
|| true
|
|| true
|
||||||
done
|
done
|
||||||
info " volumes removed"
|
info " volumes removed"
|
||||||
info " .env still on disk at $SCRIPT_DIR/.env — delete manually if desired"
|
info " removing installer directory $SCRIPT_DIR..."
|
||||||
|
rm -rf "$SCRIPT_DIR"
|
||||||
|
info " installer directory removed"
|
||||||
else
|
else
|
||||||
info "DB + bins volumes retained (run with --purge-data to delete)"
|
info "DB + bins volumes retained (run with --purge-data to delete)"
|
||||||
|
info ".env preserved at $SCRIPT_DIR/.env — secrets reused on reinstall"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "uninstall complete"
|
info "uninstall complete"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue