feat(get.sh): add --uninstall flag for one-liner uninstall
curl -fsSL .../get.sh | sudo bash -s -- --uninstall curl -fsSL .../get.sh | sudo bash -s -- --uninstall --purge-data Detects --uninstall early, resolves INSTALL_DIR from platform, and execs the on-disk uninstall.sh (passing --purge-data through). Fails fast with a clear message if Triton is not installed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6ff24df8d1
commit
ffa10f9171
1 changed files with 38 additions and 8 deletions
46
get.sh
46
get.sh
|
|
@ -11,6 +11,14 @@
|
||||||
# Pass flags through to install.sh:
|
# Pass flags through to install.sh:
|
||||||
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
||||||
# | sudo bash -s -- --gateway-hostname manage.example.com --manage-host-ip 10.0.0.5
|
# | sudo bash -s -- --gateway-hostname manage.example.com --manage-host-ip 10.0.0.5
|
||||||
|
#
|
||||||
|
# Uninstall (stop containers, keep data):
|
||||||
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
||||||
|
# | sudo bash -s -- --uninstall
|
||||||
|
#
|
||||||
|
# Uninstall and delete all data (irreversible):
|
||||||
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
||||||
|
# | sudo bash -s -- --uninstall --purge-data
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
@ -26,6 +34,16 @@ warn() { printf "${YELLOW} !${RESET} %s\n" "$*"; }
|
||||||
die() { printf "\n${RED} ✗ error:${RESET} %s\n\n" "$*" >&2; exit 1; }
|
die() { printf "\n${RED} ✗ error:${RESET} %s\n\n" "$*" >&2; exit 1; }
|
||||||
banner() { printf "\n${BOLD}%s${RESET}\n\n" "$*"; }
|
banner() { printf "\n${BOLD}%s${RESET}\n\n" "$*"; }
|
||||||
|
|
||||||
|
# ── arg pre-scan (before any output) ─────────────────────────────────────
|
||||||
|
UNINSTALL=0
|
||||||
|
PASSTHROUGH=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--uninstall) UNINSTALL=1 ;;
|
||||||
|
*) PASSTHROUGH+=("$arg") ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# ── OS detection ──────────────────────────────────────────────────────────
|
# ── OS detection ──────────────────────────────────────────────────────────
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux) PLATFORM=linux ;;
|
Linux) PLATFORM=linux ;;
|
||||||
|
|
@ -33,6 +51,25 @@ case "$(uname -s)" in
|
||||||
*) die "unsupported OS: $(uname -s)" ;;
|
*) die "unsupported OS: $(uname -s)" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# ── install directory ─────────────────────────────────────────────────────
|
||||||
|
if [[ "$PLATFORM" == "linux" ]]; then
|
||||||
|
INSTALL_DIR="/opt/triton-manage-server"
|
||||||
|
else
|
||||||
|
INSTALL_DIR="${HOME}/.local/share/triton-manage-server"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── uninstall shortcut ────────────────────────────────────────────────────
|
||||||
|
if [[ $UNINSTALL -eq 1 ]]; then
|
||||||
|
banner "▶ Triton Manage Server — Uninstaller"
|
||||||
|
info "platform: $PLATFORM"
|
||||||
|
if [[ "$PLATFORM" == "linux" && $EUID -ne 0 ]]; then
|
||||||
|
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash -s -- --uninstall"
|
||||||
|
fi
|
||||||
|
[[ -f "${INSTALL_DIR}/uninstall.sh" ]] \
|
||||||
|
|| die "Triton Manage Server does not appear to be installed (${INSTALL_DIR} not found)"
|
||||||
|
exec bash "${INSTALL_DIR}/uninstall.sh" "${PASSTHROUGH[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
banner "▶ Triton Manage Server — Installer"
|
banner "▶ Triton Manage Server — Installer"
|
||||||
info "platform: $PLATFORM"
|
info "platform: $PLATFORM"
|
||||||
|
|
||||||
|
|
@ -41,13 +78,6 @@ if [[ "$PLATFORM" == "linux" && $EUID -ne 0 ]]; then
|
||||||
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash"
|
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── install directory ─────────────────────────────────────────────────────
|
|
||||||
if [[ "$PLATFORM" == "linux" ]]; then
|
|
||||||
INSTALL_DIR="/opt/triton-manage-server"
|
|
||||||
else
|
|
||||||
INSTALL_DIR="${HOME}/.local/share/triton-manage-server"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── runtime detection ─────────────────────────────────────────────────────
|
# ── runtime detection ─────────────────────────────────────────────────────
|
||||||
has_podman() { command -v podman >/dev/null 2>&1; }
|
has_podman() { command -v podman >/dev/null 2>&1; }
|
||||||
has_docker() { command -v docker >/dev/null 2>&1; }
|
has_docker() { command -v docker >/dev/null 2>&1; }
|
||||||
|
|
@ -154,4 +184,4 @@ ok "installer files saved to ${INSTALL_DIR}"
|
||||||
|
|
||||||
# ── hand off ─────────────────────────────────────────────────────────────
|
# ── hand off ─────────────────────────────────────────────────────────────
|
||||||
echo ""
|
echo ""
|
||||||
exec bash "${INSTALL_DIR}/install.sh" "$@"
|
exec bash "${INSTALL_DIR}/install.sh" "${PASSTHROUGH[@]}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue