forge/upgrade_gitea

51 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-02-03 20:51:25 +01:00
#!/bin/bash
2022-02-05 17:12:40 +01:00
# GNU AGPLv3+
2022-02-03 20:51:25 +01:00
set -ex
BINDIR=/srv/gitea/bin
GITEA_HOME=/srv/gitea
2022-02-09 04:33:15 +01:00
export GITEA_WORK_DIR=/srv/gitea
2022-02-03 20:51:25 +01:00
cd $BINDIR
if [ -z "$1" ]; then
echo "Need version value."
else
#
VERSION="$1"
# Verify.
if ./gitea --version | grep -q "version $VERSION " ; then
echo "Same version."
else
# Download.
wget https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-linux-amd64
wget https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-linux-amd64.asc
wget https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-linux-amd64.sha256
sha256sum -c gitea-$VERSION-linux-amd64.sha256
# gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-$VERSION-linux-amd64.asc gitea-$VERSION-linux-amd64
# Flush queues.
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea -c /etc/gitea/gitea.ini manager flush-queues"
2022-02-03 20:51:25 +01:00
# Stop.
systemctl stop gitea
# Dump.
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea dump --tempdir $GITEA_HOME/tmp/ -c /etc/gitea/gitea.ini"
# Call doctor.
2023-03-06 19:14:56 +01:00
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea doctor --all --fix -c /etc/gitea/gitea.ini -C /srv/gitea/custom -w /srv/gitea"
2022-02-03 20:51:25 +01:00
# Upgrade.
chmod u+x gitea-$VERSION-linux-amd64
2022-02-09 03:04:41 +01:00
chown git.git gitea-$VERSION-linux-amd64
2022-02-03 20:51:25 +01:00
ln --force gitea-$VERSION-linux-amd64 gitea
# Start.
#systemctl start gitea
fi
fi