1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/bin/bash
-
- set -euo pipefail
-
- printf 'WARNING: Will remove everything now. Please confirm: (Y/N) '
- read answer
-
- if [ "${answer}" != "${answer#[Yy]}" ] ;then
- echo "Stopping services"
- systemctl disable --now matrix
- systemctl disable --now nginx
- systemctl disable --now coturn
-
- echo "Deleting all containers"
- for container in `docker ps -a | awk '{print $1}' | tail +2`; do docker rm -f ${container}; done
-
- echo "Purging containers data"
- docker system prune -a -f
-
- echo "Removing packages"
- cd /tmp
- apt remove -y --purge pwgen nginx python3-certbot-nginx coturn* docker*
- systemctl daemon-reload
-
- echo "Purging files and directories"
- rm -rf \
- /etc/nginx \
- /etc/turn* \
- /etc/default/coturn \
- /etc/systemd/system/matrix.service \
- /opt/matrix \
- /tmp/matrix \
- /tmp/homeserver.yaml \
- /etc/letsencrypt \
- /tmp/*.zip
-
- echo "Uninstalling and disabling firewall rules"
- ufw disable
- apt remove -y --purge ufw
-
- # Removing User's crontab
- crontab -r
-
- echo "Purging finished"
- else
- echo "KillAll aborted"
- fi
|