Skip to content

Instantly share code, notes, and snippets.

@shmick
Created November 22, 2017 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmick/f8cafb5bbc6dfe6ed4f341bf491f46f0 to your computer and use it in GitHub Desktop.
Save shmick/f8cafb5bbc6dfe6ed4f341bf491f46f0 to your computer and use it in GitHub Desktop.
#!/bin/bash
BASEURL="https://bitcoin.org/bin"
ARCH="arm-linux-gnueabihf"
VER=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases | grep -m 1 tag_name | awk -F\" '{print $4}' | cut -c 2-)
DIR="bitcoin-core-$VER"
FILE="bitcoin-$VER-$ARCH.tar.gz"
FILEURL="$BASEURL/$DIR/$FILE"
SHA256HASH=$(curl -s $BASEURL/$DIR/SHA256SUMS.asc | grep $FILE | awk '{print $1}')
if [ ! -f "$FILE" ]
then
echo "Downloading $FILEURL"
curl -sO $FILEURL
fi
shastatus=$(sha256sum $FILE | grep $SHA256HASH)
if [ "$?" -ne "0" ]
then
echo "The SHA256 has for $FILE should be $SHA256HASH. Please try again"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment