Files
linux-install-helper/gitea/uninstall.sh
2025-05-15 17:48:49 +02:00

43 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
. ./env.sh
services=("$CONTAINER_PREFIX-$CONTAINER_GITEA.service"
"$CONTAINER_PREFIX-$CONTAINER_DB.service"
)
for service in "${services[@]}"; do
if systemctl --user list-units --full --all | grep -q "$service"; then
echo "Stopping $service..."
systemctl --user stop $service
echo "$service stopped."
fi
done
containers=(
"$CONTAINER_GITEA"
"$CONTAINER_DB"
)
for container in "${containers[@]}"; do
if podman container exists "$container"; then
echo "Stop and delete existing container $container"
if podman inspect -f '{{.State.Running}}' "$container" | grep -q true; then
podman stop "$container"
fi
podman rm "$container"
fi
done
for service in "${services[@]}"; do
systemctl --user disable --now $service
rm $USER_SYSTEMD/$service
done
sudo rm -r $SERVICE_DIR
crontab -l | grep -v "$GITEA_FOLDER/$BACKUP_FILE" | crontab -
echo "Uninstall complete. Manually run haproxy config to rebuild config. Manually remove data directory
- $GITEA_FOLDER
- $HOME/.local/backup/$CONTAINER_NAME
if needed."