From ab0a9ae7219d01314da594c48ddafb991b437e66 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 2 Nov 2023 05:09:29 +0100 Subject: [PATCH] Improved upgrade script. --- doctor | 4 ++++ upgrade | 53 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 23 deletions(-) create mode 100755 doctor diff --git a/doctor b/doctor new file mode 100755 index 0000000..df251c6 --- /dev/null +++ b/doctor @@ -0,0 +1,4 @@ +#!/bin/bash + +ACTION="$@" +su - git -c "cd /srv/gitea/bin ; /srv/gitea/bin/gitea doctor -c /etc/gitea/gitea.ini -w /srv/gitea/ -C /srv/gitea/custom $ACTION" diff --git a/upgrade b/upgrade index 63cb7d3..1d261c9 100755 --- a/upgrade +++ b/upgrade @@ -16,34 +16,41 @@ else # Verify. if ./gitea --version | grep -q "version $VERSION " ; then - echo "Same version." + 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 - + # 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" - - # Stop. - systemctl stop gitea - - # Dump. - su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea dump --tempdir $GITEA_HOME/tmp/ -c /etc/gitea/gitea.ini" - + + # 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. su - git -c "cd /srv/gitea/bin ; $BINDIR/gitea doctor --all --fix -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 - # 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 + # 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 fi fi