Skip to content

Commit

Permalink
Refer to binaries with their proper extensions on Windows (#4739)
Browse files Browse the repository at this point in the history
  • Loading branch information
zah authored Mar 17, 2023
1 parent 4d1b2dd commit 6539928
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
5 changes: 5 additions & 0 deletions scripts/detect_platform.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions scripts/geth_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down
25 changes: 8 additions & 17 deletions scripts/launch_local_testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down Expand Up @@ -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=()
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -650,15 +641,15 @@ 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"
pushd "build" >/dev/null
"${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

Expand Down

0 comments on commit 6539928

Please sign in to comment.