unsafe-cleanup.sh 830 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. #set -e # Exit immediately if a command exits with a non-zero status.
  3. # Prompt to confirm
  4. echo "This will reset your system to factory defaults. Are you sure you want to do this? (y/n)"
  5. read confirm
  6. if [ "$confirm" != "y" ]; then
  7. echo "Aborting."
  8. exit 1
  9. fi
  10. ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
  11. # Stop Tipi
  12. "${ROOT_FOLDER}/scripts/stop.sh"
  13. echo y | docker system prune
  14. echo y | docker volume prune
  15. echo y | docker network prune
  16. echo y | docker container prune
  17. echo y | docker image prune -a
  18. # Remove everything in app-data folder
  19. rm -rf "${ROOT_FOLDER}/app-data"
  20. rm -rf "${ROOT_FOLDER}/data/postgres"
  21. mkdir -p "${ROOT_FOLDER}/app-data"
  22. # Put {"installed":""} in state/apps.json
  23. echo '{"installed":""}' >"${ROOT_FOLDER}/state/apps.json"
  24. "${ROOT_FOLDER}/scripts/start.sh"