Gitea instance to host some of my code and to rebuild this website using a post-receive hook. One of the main advantages of using Gitea instead of some other software is that it comes as a single executable. This makes it installing and updating it a breeze.
I found this script through a Google search that automates the download and updating of the Gitea binary. I have minimally modified it to fit my needs and now everything works nicely.
Here is the complete script in case the upstream repo goes down:
#!/bin/bash
VERSION=1.12.2
DIR=/usr/local
ARCH=linux-amd64
echo
echo -e " _ _ "
echo -e " __ _(_) |_ ___ __ _ "
echo -e " / _\` | | __/ _ \/ _\` |"
echo -e " | (_| | | || __/ (_| |"
echo -e " \__, |_|\__\___|\__,_|"
echo -e " |___/ Git with a cup of tea"
echo
echo
echo -e "Update of gitea to ${VERSION} is in progress..."
echo
echo -e "DIR=$DIR \nARCH=$ARCH"
echo -e "\nLatest versions of gitea:\n"
# edit when v2 comes out
curl -s https://dl.gitea.io/gitea/ | grep '<a href\=\"\/gitea/1' | cut -d"/" -f3 | sort --version-sort | tail -n 5
if [ -f $DIR/bin/gitea-$VERSION-$ARCH ]; then
echo -e "\nVersion ${VERSION} is already downloaded!\n"
else
echo -e "\nNewer version ${VERSION} is available!\n"
echo -e "Downloading the newest version..."
wget -N https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-$ARCH -P $DIR/bin/
echo -e "\nCreating symlinks..."
ln -sfv $DIR/bin/gitea-$VERSION-$ARCH $DIR/gitea
echo -e "\nFixing permissions..."
chmod -v +x $DIR/bin/gitea-$VERSION-$ARCH
echo -e "\nRestarting service..."
service gitea restart
fi
echo -e "\nGitea service status:\n"
service gitea status
echo -e "\nHave a nice day :)\n"