forked from Sophia/thelinuxlist
EOL this project :(
This commit is contained in:
@ -1,16 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Function to perform uninstallation
|
||||
uninstall_gitea() {
|
||||
echo "Stopping Gitea service..."
|
||||
sudo systemctl stop gitea
|
||||
|
||||
echo "Disabling Gitea service..."
|
||||
sudo systemctl disable gitea
|
||||
|
||||
echo "Removing Gitea service file..."
|
||||
sudo rm -rf /etc/systemd/system/gitea.service
|
||||
|
||||
echo "Backing up files..."
|
||||
timestamp=$(date +"%Y%m%d_%H%M%S")
|
||||
tar -cvzf "gitea_backup_${timestamp}.tar.gz" /var/lib/gitea/ /etc/gitea || { echo "Failed to backup files. Exiting."; exit 1; }
|
||||
|
||||
echo "Removing Gitea user and home directory..."
|
||||
sudo userdel -r git || { echo "Failed to delete Gitea user. Exiting."; exit 1; }
|
||||
|
||||
echo "Removing Gitea binary..."
|
||||
sudo rm -rf /usr/local/bin/gitea
|
||||
|
||||
echo "Cleaning up Gitea data and configuration..."
|
||||
sudo rm -rf /var/lib/gitea/* /etc/gitea
|
||||
|
||||
echo "Removing firewall rule for port 3000..."
|
||||
sudo ufw delete allow 3000
|
||||
|
||||
echo "Gitea has been uninstalled, and all files have been backed up."
|
||||
}
|
||||
|
||||
# Main script
|
||||
trap 'exit 130' INT
|
||||
sudo systemctl stop gitea
|
||||
sudo systemctl disable gitea
|
||||
sudo rm -rf /etc/systemd/system/gitea.service
|
||||
echo "Backing up Files"
|
||||
tar -cvzf gitea.tar.gz /var/lib/gitea/ /etc/gitea
|
||||
sudo rm -rf /home/git
|
||||
sudo userdel git
|
||||
sudo rm -rf /usr/local/bin/gitea
|
||||
sudo rm -rf /var/lib/gitea/*
|
||||
sudo rm -rf /etc/gitea
|
||||
sudo ufw delete allow 3000
|
||||
|
||||
echo "Gitea has been uninstalled, and all files have are backed up in gitea.tar.gz, you can delete it at your discretion."
|
||||
# Automate confirmation by assuming yes to the prompt
|
||||
uninstall_gitea
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user