Change prysm script to support windows (#5479)

* Change prysm script to support windows
* Update prysm.sh
This commit is contained in:
Ivan Martinez 2020-04-17 15:11:51 -04:00 committed by GitHub
parent 475d428fce
commit 7a65e0ee3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,20 @@ readonly wrapper_dir="$(dirname "$(get_realpath "${BASH_SOURCE[0]}")")/dist"
arch=$(uname -m)
arch=${arch/x86_64/amd64}
arch=${arch/aarch64/arm64}
readonly os_arch_suffix="$(uname -s | tr '[:upper:]' '[:lower:]')-$arch"
system=""
case "$OSTYPE" in
darwin*) system="darwin" ;;
linux*) system="linux" ;;
msys*) system="windows" ;;
cygwin*) system="windows" ;;
*) exit 1 ;;
esac
if [ "$system" == "windows" ]
then
arch="amd64.exe"
fi
mkdir -p $wrapper_dir
@ -91,13 +104,12 @@ get_prysm_version
color "37" "Latest Prysm version is $prysm_version."
BEACON_CHAIN_REAL="${wrapper_dir}/beacon-chain-${prysm_version}-${os_arch_suffix}"
VALIDATOR_REAL="${wrapper_dir}/validator-${prysm_version}-${os_arch_suffix}"
BEACON_CHAIN_REAL="${wrapper_dir}/beacon-chain-${prysm_version}-${system}-${arch}"
VALIDATOR_REAL="${wrapper_dir}/validator-${prysm_version}-${system}-${arch}"
if [[ ! -x $BEACON_CHAIN_REAL ]]; then
color "34" "Downloading beacon chain@${prysm_version} to ${BEACON_CHAIN_REAL} (${reason})"
curl -L "https://github.com/prysmaticlabs/prysm/releases/download/${prysm_version}/beacon-chain-${prysm_version}-${os_arch_suffix}" -o $BEACON_CHAIN_REAL
curl -L "https://github.com/prysmaticlabs/prysm/releases/download/${prysm_version}/beacon-chain-${prysm_version}-${system}-${arch}" -o $BEACON_CHAIN_REAL
chmod +x $BEACON_CHAIN_REAL
else
color "37" "Beacon chain is up to date."
@ -106,7 +118,7 @@ fi
if [[ ! -x $VALIDATOR_REAL ]]; then
color "34" "Downloading validator@${prysm_version} to ${VALIDATOR_REAL} (${reason})"
curl -L "https://github.com/prysmaticlabs/prysm/releases/download/${prysm_version}/validator-${prysm_version}-${os_arch_suffix}" -o $VALIDATOR_REAL
curl -L "https://github.com/prysmaticlabs/prysm/releases/download/${prysm_version}/validator-${prysm_version}-${system}-${arch}" -o $VALIDATOR_REAL
chmod +x $VALIDATOR_REAL
else
color "37" "Validator is up to date."
@ -128,4 +140,4 @@ case $1 in
esac
color "36" "Starting Prysm $1 ${@:2}"
exec -a "$0" "${process}" "${@:2}"
exec -a "$0" "${process}" "${@:2}"