Last active
October 5, 2021 06:41
-
-
Save kumpelblase2/1cc9a40f0287279291f060927c4a087c to your computer and use it in GitHub Desktop.
Script to update gitea to a version on an alpine host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BINARY_LOCATION="/usr/bin/gitea" | |
ARCHIVE_FILENAME="gitea-$1-linux-amd64.xz" | |
FILENAME="gitea-$1-linux-amd64" | |
URL="https://dl.gitea.io/gitea/$1/gitea-$1-linux-amd64.xz" | |
URL_HASH="https://dl.gitea.io/gitea/$1/gitea-$1-linux-amd64.xz.sha256" | |
URL_SIGN="https://dl.gitea.io/gitea/$1/gitea-$1-linux-amd64.xz.asc" | |
rc-service gitea stop | |
curl -O -L "$URL" | |
curl -O -L "$URL_HASH" | |
curl -O -L "$URL_SIGN" | |
sha256sum -c "$ARCHIVE_FILENAME.sha256" | |
if [[ $? -ne 0 ]] | |
then | |
echo "SHA256 doesn't match" | |
exit 1 | |
fi | |
gpg --verify "$ARCHIVE_FILENAME.asc" "$ARCHIVE_FILENAME" | |
if [[ $? -ne 0 ]] | |
then | |
echo "GPG Signature fail" | |
exit 1 | |
fi | |
rm "$ARCHIVE_FILENAME.sha256" | |
rm "$ARCHIVE_FILENAME.asc" | |
xz -d $ARCHIVE_FILENAME | |
mv $FILENAME $BINARY_LOCATION | |
chmod +x $BINARY_LOCATION | |
setcap CAP_NET_BIND_SERVICE=+eip $BINARY_LOCATION | |
rc-service gitea start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment