# ============
# Update Gitea
# ============
# ---
# get info on new releases
#
# see: https://blog.gitea.com/tags/release/
# ---
export GITEA_RELEASE_NUMBER="1.22.1"
echo $GITEA_RELEASE_NUMBER
# use terminal multiplexer for security and flexibility
#
tmux
# run commands as user git
#
su git -s /bin/bash -
mkdir -p /home/git/temp_backups
# check if everything is OK
#
/usr/local/bin/gitea doctor check \
--config /etc/gitea/app.ini \
--work-path /var/lib/gitea/ \
--custom-path /var/lib/gitea/custom/
# make a backup
#
cd /home/git/temp_backups &&
/usr/local/bin/gitea dump \
--config /etc/gitea/app.ini \
--custom-path /var/lib/gitea/custom \
--work-path /var/lib/gitea
# Add pub-key to your key-ring only if necessary:
#
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
# download new binary and signature and verify the download
#
cd /tmp &&
wget https://dl.gitea.com/gitea/$GITEA_RELEASE_NUMBER/gitea-$GITEA_RELEASE_NUMBER-linux-amd64 &&
wget https://dl.gitea.com/gitea/$GITEA_RELEASE_NUMBER/gitea-$GITEA_RELEASE_NUMBER-linux-amd64.asc &&
gpg --verify gitea-$GITEA_RELEASE_NUMBER-linux-amd64.asc gitea-$GITEA_RELEASE_NUMBER-linux-amd64
# exit from git user back to root user
#
exit
# as root-user: stop service
#
systemctl stop gitea
# as root-user: move binary in place
#
mv /tmp/gitea-$GITEA_RELEASE_NUMBER-linux-amd64 /usr/local/bin/
chmod u+x /usr/local/bin/gitea-$GITEA_RELEASE_NUMBER-linux-amd64
chown git:git /usr/local/bin/gitea-$GITEA_RELEASE_NUMBER-linux-amd64
# Delete and Renew symlink to new gitea binary
#
rm /usr/local/bin/gitea
ln -s gitea-$GITEA_RELEASE_NUMBER-linux-amd64 /usr/local/bin/gitea
# as root-user: start service
#
systemctl start gitea && systemctl restart nginx
# run commands as user git
#
su git -s /bin/bash -
# check if everything is OK
#
/usr/local/bin/gitea doctor check \
--config /etc/gitea/app.ini \
--work-path /var/lib/gitea/ \
--custom-path /var/lib/gitea/custom/
# remove remaining OpenPGP-signature from /tmp directory
#
rm /tmp/gitea-$GITEA_RELEASE_NUMBER-linux-amd64.asc
# check on website
#
# visit:
# https://git.warenform.de/admin/config
# https://git.oopen.de/admin/config
# https://todo.so36.net/admin/config