Created
September 20, 2017 12:18
-
-
Save Freccia/e3e6fe16239828d19ea2b42da3be5fc9 to your computer and use it in GitHub Desktop.
Download and verify Borg Backup executable (stable release)
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
#!/usr/bin/env bash | |
# This script is tested on OS X (10.12.6) | |
# but is likely to work on Linux | |
RED="\033[1;31m" | |
GREEN="\033[1;32m" | |
ENDC="\033[0m" | |
# STABLE RELEASE | |
BORG_LINK="https://github.com/borgbackup/borg/releases/download/1.0.11/" | |
BORG_EXEC="borg-macosx64" | |
BORG_SIG="borg-macosx64.asc" | |
THOMAS_WALDMAN_KEY="6D5BEF9ADD2075805747B70F9F88FB52FAF7B393" | |
if [ -x $(command -v wget) ]; then | |
wget -nv ${BORG_LINK}${BORG_EXEC} | |
wget -nv ${BORG_LINK}${BORG_SIG} | |
elif [ -x $(command -v curl) ]; then | |
curl -sSL -o ${BORG_EXEC} ${BORG_LINK}${BORG_EXEC} | |
curl -sSL -o ${BORG_SIG} ${BORG_LINK}${BORG_SIG} | |
fi | |
if [ -x $(command -v gpg) ]; then | |
gpg --keyserver pgp.mit.edu --recv-keys ${THOMAS_WALDMAN_KEY} | |
gpg --verify ${BORG_SIG} ${BORG_EXEC} | |
if [ "$?" -ne 0 ];then | |
printf "[ ${RED}FAILED${ENDC} ] Signature verification.\n" | |
rm -vi ${BORG_EXEC} ${BORG_SIG} | |
exit 1 | |
else | |
printf "[ ${GREEN}OK${ENDC} ] Signature verification.\n" | |
fi | |
else | |
echo "Please download ${RED}GPG${ENDC} to verify the downloaded file." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment