forked from Sophia/thelinuxlist
EOL this project :(
This commit is contained in:
@ -1,32 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
trap 'exit 130' INT
|
||||
while true
|
||||
do
|
||||
read -r -p "Would you like to uninstall Gitea? This is not reversible. [Y/n] " input
|
||||
|
||||
case $input in
|
||||
|
||||
# Function to prompt user for confirmation
|
||||
prompt_confirmation() {
|
||||
while true; do
|
||||
read -r -p "Would you like to uninstall Gitea? This is not reversible. [Y/n] " input
|
||||
|
||||
case $input in
|
||||
[yY][eE][sS]|[yY])
|
||||
break
|
||||
;;
|
||||
return 0
|
||||
;;
|
||||
[nN][oO]|[nN])
|
||||
break
|
||||
;;
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo "That wasn't an option..."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
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 "That wasn't an option..."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
echo "Gitea has been uninstalled, and all files have are backed up in gitea.tar.gz, you can delete it at your discretion."
|
||||
# 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
|
||||
|
||||
if prompt_confirmation; then
|
||||
uninstall_gitea
|
||||
else
|
||||
echo "Gitea uninstallation aborted."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user