2021-11-07 11:36:29 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
BINDIR=/srv/gitea/bin
|
|
|
|
GITEA_HOME=/srv/gitea
|
2022-02-09 03:34:48 +01:00
|
|
|
export GITEA_WORK_DIR=/srv/gitea
|
2021-11-07 11:36:29 +01:00
|
|
|
|
|
|
|
cd $BINDIR
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Need version value."
|
|
|
|
else
|
|
|
|
#
|
|
|
|
VERSION="$1"
|
|
|
|
|
|
|
|
# Verify.
|
|
|
|
if ./gitea --version | grep -q "version $VERSION " ; then
|
2024-07-24 02:35:13 +02:00
|
|
|
echo "Same version."
|
2021-11-07 11:36:29 +01:00
|
|
|
else
|
2024-07-24 02:35:13 +02:00
|
|
|
# Download the binary file.
|
|
|
|
wget https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/forgejo-${VERSION}-linux-amd64
|
|
|
|
|
|
|
|
# Check the binary file.
|
|
|
|
wget https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/forgejo-${VERSION}-linux-amd64.sha256
|
|
|
|
sha256sum -c forgejo-${VERSION}-linux-amd64.sha256
|
|
|
|
|
|
|
|
# Verify the binary file.
|
|
|
|
wget https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/forgejo-${VERSION}-linux-amd64.asc
|
|
|
|
# gpg --keyserver keys.openpgp.org --recv EB114F5E6C0DC2BCDD183550A4B61A2DC5923710
|
|
|
|
gpg --verify forgejo-${VERSION}-linux-amd64.asc forgejo-${VERSION}-linux-amd64
|
|
|
|
|
2022-06-13 21:21:55 +02:00
|
|
|
# Flush queues.
|
|
|
|
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea -c /etc/gitea/gitea.ini manager flush-queues"
|
2023-11-02 05:09:29 +01:00
|
|
|
|
2024-07-24 02:35:13 +02:00
|
|
|
# Stop.
|
|
|
|
systemctl stop gitea
|
2023-11-02 05:09:29 +01:00
|
|
|
|
2024-07-24 02:35:13 +02:00
|
|
|
# Dump.
|
|
|
|
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea dump --tempdir $GITEA_HOME/tmp/ -c /etc/gitea/gitea.ini"
|
2023-11-02 05:09:29 +01:00
|
|
|
|
2022-06-13 21:21:55 +02:00
|
|
|
# Call doctor.
|
2024-07-24 02:35:13 +02:00
|
|
|
#su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea doctor --all --fix -c /etc/gitea/gitea.ini"
|
|
|
|
#su - git -c "cd /srv/forgejo/bin ; $BINDIR/forgejo doctor --all --fix -c /etc/forgejo/forgejo.ini -C /srv/forgejo/custom -w /srv/forgejo/"
|
|
|
|
su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea doctor check --all --fix -c /etc/gitea/gitea.ini -C /srv/gitea/custom -w /srv/gitea/"
|
|
|
|
|
|
|
|
# Upgrade.
|
|
|
|
chmod u+x forgejo-$VERSION-linux-amd64
|
|
|
|
chown git:gitea forgejo-$VERSION-linux-amd64
|
|
|
|
ln --force forgejo-$VERSION-linux-amd64 gitea
|
2023-11-02 05:09:29 +01:00
|
|
|
|
|
|
|
# Start.
|
|
|
|
#systemctl start gitea
|
|
|
|
echo "Please, check then start the service Gitea."
|
|
|
|
read -e -p "Start Gitea service? [Y/n] " choice
|
|
|
|
if [[ "$choice" =~ ^[yY]$ ]]; then
|
|
|
|
echo "Restarting…"
|
|
|
|
systemctl start gitea
|
|
|
|
journalctl -f -u gitea
|
|
|
|
fi
|
2021-11-07 11:36:29 +01:00
|
|
|
fi
|
|
|
|
fi
|