diff --git a/get_geth.sh b/get_geth.sh index 9414068..a3afba3 100755 --- a/get_geth.sh +++ b/get_geth.sh @@ -1,18 +1,23 @@ #!/bin/bash # WARNING: the following script has a high concentration of YOLOs -# Note: $HOMEDIR is defined in main.js, check it out - set -e +# Note: $HOMEDIR is defined in main.js, check it out +HOMEDIR=${HOMEDIR:-"."} + +# Unfortunately GitHub ratelimits the following requests when running on travis. That's the reason why I had to hardcode the values of VERSION and COMMIT for now. +# VERSION=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/releases/latest | python -c "import sys, json; print(json.load(sys.stdin)['tag_name'])") +# COMMIT=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/commits/${VERSION} | python -c "import sys, json; print(json.load(sys.stdin)['sha'])") +VERSION="1.8.27" +COMMIT="4bcc0a37" PLATFORM=$(uname | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) - -VERSION=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/releases/latest | python -c "import sys, json; print(json.load(sys.stdin)['tag_name'])") -COMMIT=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/commits/${VERSION} | python -c "import sys, json; print(json.load(sys.stdin)['sha'])") -NAME="geth-${PLATFORM}-amd64-${VERSION:1}-${COMMIT:0:8}" +NAME="geth-${PLATFORM}-amd64-${VERSION}-${COMMIT}" DOWNLOAD_URL="https://gethstore.blob.core.windows.net/builds/${NAME}.tar.gz" TMP_FILE=$(mktemp) + +echo "Downloading ${DOWNLOAD_URL}" curl --fail ${DOWNLOAD_URL} | tar -Oxzf - ${NAME}/geth > ${TMP_FILE} mv ${TMP_FILE} ${HOMEDIR}/geth chmod +x ${HOMEDIR}/geth