Add script to automatically remove Gitea.

This commit is contained in:
Josh Mudge 2018-07-26 15:16:16 -06:00
parent dcb820e844
commit f389c2cad2
3 changed files with 24 additions and 6 deletions

View File

@ -45,21 +45,21 @@ Click on "Admin Account Settings" to setup your user account and click "Install
If you want to install Gitea manually, you can follow these instructions: If you want to install Gitea manually, you can follow these instructions:
```bash ```bash
# Create a 'gitea' user and group with the home /opt/gitea, no password (because it's a system user) and no GECOS ### Create a 'gitea' user and group with the home /opt/gitea, no password (because it's a system user) and no GECOS
sudo adduser gitea --home /opt/gitea --disabled-password --gecos '' sudo adduser gitea --home /opt/gitea --disabled-password --gecos ''
# Make some other potentially useful directories for that user/group ### Make some other potentially useful directories for that user/group
sudo mkdir -p /opt/gitea/ /var/log/gitea sudo mkdir -p /opt/gitea/ /var/log/gitea
sudo chown -R gitea:gitea /opt/gitea/ /var/log/gitea sudo chown -R gitea:gitea /opt/gitea/ /var/log/gitea
# Download and install gitea. Replace "amd64" with "i386" for 32 bit x86 or "arm-7" for ARMv7 and "arm-6" for ARMv6. ### Download and install gitea. Replace "amd64" with "i386" for 32 bit x86 or "arm-7" for ARMv7 and "arm-6" for ARMv6.
sudo wget -O /opt/gitea/gitea https://dl.gitea.io/gitea/1.4.1/gitea-1.4.1-linux-amd64 sudo wget -O /opt/gitea/gitea https://dl.gitea.io/gitea/1.4.1/gitea-1.4.1-linux-amd64
sudo chmod +x /opt/gitea/gitea sudo chmod +x /opt/gitea/gitea
# Download and install the gitea.service for systemd ### Download and install the gitea.service for systemd
sudo wget -O /etc/systemd/system/gitea.service https://git.coolaj86.com/coolaj86/gitea-installer.sh/raw/master/dist/etc/systemd/system/gitea.service sudo wget -O /etc/systemd/system/gitea.service https://git.coolaj86.com/coolaj86/gitea-installer.sh/raw/master/dist/etc/systemd/system/gitea.service
# Start gitea ### Start gitea
sudo systemctl restart gitea sudo systemctl restart gitea
``` ```
@ -103,3 +103,9 @@ You can find more information about customization and templates in the docs and
# Troubleshooting systemd # Troubleshooting systemd
See [Troubleshooting systemd](https://git.coolaj86.com/coolaj86/service-installer.sh/src/master/README.md#troubleshooting-systemd) See [Troubleshooting systemd](https://git.coolaj86.com/coolaj86/service-installer.sh/src/master/README.md#troubleshooting-systemd)
# Removing Gitea
Run this command to uninstall Gitea: (THIS WILL REMOVE ALL DATA if you are using SQLite!)
`curl -fsSL https://git.coolaj86.com/coolaj86/gitea-installer.sh/raw/branch/master/remove.bash | bash`

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Most of code credit for determining version is here: https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c # Most of the code credit for determining version is here: https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | # Get latest release from GitHub api VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value

12
remove.sh Normal file
View File

@ -0,0 +1,12 @@
# Gitea Uninstall Script
# This script removes Gitea as installed by this script. THIS DELTES ALL DATA if you are using SQLite.
echo "Removing Gitea and DELETING ALL DATA."
sudo systemctl stop gitea # Stop the Gitea service
sudo systemctl disable gitea # Disable the Gitea service automatically starting on boot.
sudo rm /etc/systemd/system/gitea.service # Delete the Gitea service.
sudo rm /usr/local/bin/gitea # Remove Gitea from Path
sudo rm -rf /opt/gitea # Remove Gitea Data
echo "Done."