A yasopp/forgejo-update.sh => yasopp/forgejo-update.sh +34 -0
@@ 0,0 1,34 @@
+#!/bin/bash
+
+VERSION="1.21.6-0"
+TMPDIR="~/_forgejo_tmp"
+
+if [ "$EUID" -ne 0 ]
+ then echo "Please run as root"
+ exit
+fi
+
+cd ~/ && mkdir "${TMPDIR:?}" && cd "${TMPDIR}" || exit
+
+echo "Retrieving and checking binary file"
+wget "https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/forgejo-${VERSION}-linux-amd64"
+
+wget "https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/forgejo-${VERSION}-linux-amd64.asc"
+gpg --verify "forgejo-${VERSION}-linux-amd64.asc" "forgejo-${VERSION}-linux-amd64" || echo "Not verified package"; exit
+echo ""
+
+echo "Moving binary and making it executable"
+mv "forgejo-${VERSION}-linux-amd64" /usr/local/bin/forgejo
+chmod +x /usr/local/bin/forgejo
+chmod 755 /usr/local/bin/forgejo
+echo ""
+
+echo "Removing tmpdir"
+rm -rf "${TMPDIR:?}"
+echo ""
+
+echo "Restarting forgejo service"
+systemctl restart forgejo.service
+echo ""
+
+echo "Update is DONE."