From 76682dffc6dbd34b79188792a04758ea618a4448 Mon Sep 17 00:00:00 2001 From: Christian MOMON Date: Thu, 3 Feb 2022 19:51:25 +0000 Subject: [PATCH] Add new file --- upgrade_gitea | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 upgrade_gitea diff --git a/upgrade_gitea b/upgrade_gitea new file mode 100644 index 0000000..00493a5 --- /dev/null +++ b/upgrade_gitea @@ -0,0 +1,42 @@ +#!/bin/bash + +set -ex + +BINDIR=/srv/gitea/bin +GITEA_HOME=/srv/gitea + +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 + + # Stop. + systemctl stop gitea + + # Dump. + su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea dump --tempdir $GITEA_HOME/tmp/ -c /etc/gitea/gitea.ini" + + # Upgrade. + chmod u+x gitea-$VERSION-linux-amd64 + chown git.gitea gitea-$VERSION-linux-amd64 + ln --force gitea-$VERSION-linux-amd64 gitea + + # Start. + #systemctl start gitea + fi +fi