diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..f321c79 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# --- Configuration --- +COMPOSE_FILE="docker-compose.yml" +DATA_DIRS=("db_data" "filerun_html" "user_data") +# --------------------- + +echo "🛑 Stopping and removing all services defined in ${COMPOSE_FILE}..." +# docker compose down: Stops containers, removes containers, and removes networks +# --volumes: Removes anonymous volumes, though we are using named directories. +docker compose -f "${COMPOSE_FILE}" down --volumes + +if [ $? -ne 0 ]; then + echo "❌ Docker Compose failed to stop and remove services. Aborting data removal." + exit 1 +fi + +echo "---" +echo "🗑️ Removing persistent data directories..." + +for dir in "${DATA_DIRS[@]}"; do + if [ -d "$dir" ]; then + echo " -> Removing directory: ${dir}/" + # The 'rm -rf' command deletes the directory and all its contents + sudo rm -rf "$dir" + if [ $? -eq 0 ]; then + echo " [SUCCESS]" + else + echo " [FAILED] Could not remove ${dir}. Manual intervention may be required." + fi + else + echo " -> Directory not found: ${dir}/ (Skipping)" + fi +done + +echo "---" +echo "✅ Uninstallation complete. All data and services have been removed." \ No newline at end of file