diff --git a/scripts/detect_platform.sh b/scripts/detect_platform.sh index 82bd975ba..411eaa563 100644 --- a/scripts/detect_platform.sh +++ b/scripts/detect_platform.sh @@ -1,12 +1,17 @@ if [ -z "${DETECT_PLATFORM_SOURCED:-}" ]; then DETECT_PLATFORM_SOURCED=1 +EXE_EXTENSION="" +BAT_EXTENSION="" + # OS detection OS="linux" if uname | grep -qi darwin; then OS="macos" elif uname | grep -qiE "mingw|msys"; then OS="windows" + EXE_EXTENSION=".exe" + BAT_EXTENSION=".bat" fi # Architecture detection diff --git a/scripts/geth_binaries.sh b/scripts/geth_binaries.sh index b0023186f..69e7cf487 100644 --- a/scripts/geth_binaries.sh +++ b/scripts/geth_binaries.sh @@ -8,9 +8,9 @@ source "${SCRIPTS_DIR}/detect_platform.sh" source "${SCRIPTS_DIR}/bash_utils.sh" : ${CURL_BINARY:="curl"} -: ${STABLE_GETH_BINARY:="${BUILD_DIR}/downloads/geth"} -: ${GETH_CAPELLA_BINARY:="${BUILD_DIR}/downloads/geth_capella"} -: ${GETH_DENEB_BINARY:="${BUILD_DIR}/downloads/geth_deneb"} +: ${STABLE_GETH_BINARY:="${BUILD_DIR}/downloads/geth$EXE_EXTENSION"} +: ${GETH_CAPELLA_BINARY:="${BUILD_DIR}/downloads/geth_capella$EXE_EXTENSION"} +: ${GETH_DENEB_BINARY:="${BUILD_DIR}/downloads/geth_deneb$EXE_EXTENSION"} download_geth_stable() { if [[ ! -e "${STABLE_GETH_BINARY}" ]]; then @@ -49,7 +49,7 @@ download_geth_stable() { CLEANUP_DIRS+=("$tmp_extract_dir") tar -xzf "$GETH_TARBALL" -C "$tmp_extract_dir" --strip-components=1 mkdir -p "$(dirname "$STABLE_GETH_BINARY")" - mv "$tmp_extract_dir/geth" "$STABLE_GETH_BINARY" + mv "$tmp_extract_dir/geth$EXE_EXTENSION" "$STABLE_GETH_BINARY" chmod +x "$STABLE_GETH_BINARY" fi } @@ -85,7 +85,7 @@ download_status_geth_binary() { GETH_TARBALL_NAME="geth-binaries-${GETH_PLATFORM}.tar.gz" GETH_TARBALL_URL="https://github.com/status-im/nimbus-simulation-binaries/releases/download/latest/${GETH_TARBALL_NAME}" - GETH_BINARY_IN_TARBALL="geth/${BINARY_NAME}/geth" + GETH_BINARY_IN_TARBALL="geth/${BINARY_NAME}/geth$EXE_EXTENSION" "$CURL_BINARY" -o "$GETH_TARBALL_NAME" -sSL "$GETH_TARBALL_URL" local tmp_extract_dir @@ -94,7 +94,7 @@ download_status_geth_binary() { tar -xzf "$GETH_TARBALL_NAME" -C "$tmp_extract_dir" --strip-components 2 \ "$GETH_BINARY_IN_TARBALL" mkdir -p "$(dirname "$BINARY_FS_PATH")" - mv "$tmp_extract_dir/geth" "$BINARY_FS_PATH" + mv "$tmp_extract_dir/geth$EXE_EXTENSION" "$BINARY_FS_PATH" chmod +x "$BINARY_FS_PATH" fi } diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index adec89782..76de709b2 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -24,16 +24,7 @@ log() { fi } -# OS detection -OS="linux" -if uname | grep -qi darwin; then - OS="macos" -elif uname | grep -qiE "mingw|msys"; then - OS="windows" -fi - -# architecture detection -ARCH="$(uname -m)" +source "$SCRIPTS_DIR/detect_platform.sh" # Created processed that will be cleaned up when the script exits PIDS="" @@ -110,15 +101,15 @@ DL_GETH="0" : ${NIMBUS_ETH2_VERSION:=22.12.0} : ${NIMBUS_ETH2_REVISION:=f6a5a5b1} -: ${BEACON_NODE_COMMAND:="./build/nimbus_beacon_node"} +: ${BEACON_NODE_COMMAND:="./build/nimbus_beacon_node$EXE_EXTENSION"} : ${CAPELLA_FORK_EPOCH:=40} : ${DENEB_FORK_EPOCH:=50} #NIMBUS EL VARS RUN_NIMBUS_ETH1="0" -: ${NIMBUS_ETH1_BINARY:="./build/downloads/nimbus"} +: ${NIMBUS_ETH1_BINARY:="./build/downloads/nimbus$EXE_EXTENSION"} : ${WEB3SIGNER_VERSION:=22.11.0} : ${WEB3SIGNER_DIR:="${BUILD_DIR}/downloads/web3signer-${WEB3SIGNER_VERSION}"} -: ${WEB3SIGNER_BINARY:="${WEB3SIGNER_DIR}/bin/web3signer"} +: ${WEB3SIGNER_BINARY:="${WEB3SIGNER_DIR}/bin/web3signer$BAT_EXTENSION"} WEB3SIGNER_NODES=0 PROCS_TO_KILL=("nimbus_beacon_node" "nimbus_validator_client" "nimbus_signing_node" "nimbus_light_client") PORTS_TO_KILL=() @@ -584,7 +575,7 @@ download_nimbus_eth1() { CLEANUP_DIRS+=("$tmp_extract_dir") tar -xzf "${NIMBUS_ETH1_TARBALL_NAME}" -C "$tmp_extract_dir" --strip-components=1 mkdir -p "$(dirname "$NIMBUS_ETH1_BINARY")" - mv "$tmp_extract_dir/build/nimbus" "$NIMBUS_ETH1_BINARY" + mv "$tmp_extract_dir/build/nimbus$EXE_EXTENSION" "$NIMBUS_ETH1_BINARY" chmod +x "$NIMBUS_ETH1_BINARY" fi } @@ -624,7 +615,7 @@ download_nimbus_eth2() { CLEANUP_DIRS+=("$tmp_extract_dir") tar -xzf "${NIMBUS_ETH2_TARBALL_NAME}" -C "$tmp_extract_dir" --strip-components=1 mkdir -p "$(dirname "$BEACON_NODE_COMMAND")" - mv "$tmp_extract_dir/build/nimbus_beacon_node" "$BEACON_NODE_COMMAND" + mv "$tmp_extract_dir/build/nimbus_beacon_node$EXE_EXTENSION" "$BEACON_NODE_COMMAND" chmod +x "$BEACON_NODE_COMMAND" REUSE_BINARIES=1 @@ -650,7 +641,7 @@ case "${OS}" in ;; esac LH_URL="https://github.com/sigp/lighthouse/releases/download/v${LH_VERSION}/${LH_TARBALL}" -LH_BINARY="lighthouse-${LH_VERSION}" +LH_BINARY="lighthouse-${LH_VERSION}${EXE_EXTENSION}" if [[ "${USE_VC}" == "1" && "${LIGHTHOUSE_VC_NODES}" != "0" && ! -e "build/${LH_BINARY}" ]]; then echo "Downloading Lighthouse binary" @@ -658,7 +649,7 @@ if [[ "${USE_VC}" == "1" && "${LIGHTHOUSE_VC_NODES}" != "0" && ! -e "build/${LH_ "${CURL_BINARY}" -sSLO "${LH_URL}" tar -xzf "${LH_TARBALL}" # contains just one file named "lighthouse" rm lighthouse-* # deletes both the tarball and old binary versions - mv lighthouse "${LH_BINARY}" + mv "lighthouse$EXE_EXTENSION" "${LH_BINARY}" popd >/dev/null fi