From 7a65e0ee3fdd8badc4ae359a3a6899452cd28452 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Fri, 17 Apr 2020 15:11:51 -0400 Subject: [PATCH] Change prysm script to support windows (#5479) * Change prysm script to support windows * Update prysm.sh --- prysm.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/prysm.sh b/prysm.sh index 1acef6c3b..053221bd9 100755 --- a/prysm.sh +++ b/prysm.sh @@ -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}" \ No newline at end of file +exec -a "$0" "${process}" "${@:2}"