From d72c2716625f8293402acd3fec476c0d7c93a155 Mon Sep 17 00:00:00 2001 From: coincashew Date: Thu, 25 Jul 2024 22:41:08 -0700 Subject: [PATCH] Add ARM64 architecture support --- deploy-nimbus-nethermind.py | 54 +++++++++++++++++++++++++++++++----- eth-duties.sh | 19 ++++++++++++- ethdo.sh | 14 ++++++++-- ethereum-metrics-exporter.sh | 17 +++++++----- ethpillar.sh | 11 ++++++-- functions.sh | 23 +++++++++++++++ install-nimbus-nethermind.sh | 19 +++++++++++++ install.sh | 6 ++-- manage_validator_keys.sh | 22 +++++++++++---- update_consensus.sh | 20 +++++++++---- update_execution.sh | 21 ++++++++++---- update_mevboost.sh | 6 +++- 12 files changed, 192 insertions(+), 40 deletions(-) diff --git a/deploy-nimbus-nethermind.py b/deploy-nimbus-nethermind.py index bd88408..6bf246b 100644 --- a/deploy-nimbus-nethermind.py +++ b/deploy-nimbus-nethermind.py @@ -25,6 +25,7 @@ import zipfile import random import sys +import platform from consolemenu import * from consolemenu.items import * import argparse @@ -125,6 +126,27 @@ args = parser.parse_args() #print(args) +def get_machine_architecture(): + machine_arch=platform.machine() + if machine_arch == "x86_64": + return "amd64" + elif machine_arch == "aarch64": + return "arm64" + else: + print(f'Unsupported machine architecture: {machine_arch}') + exit(1) + +def get_computer_platform(): + platform_name=platform.system() + if platform_name == "Linux": + return platform_name + else: + print(f'Unsupported platform: {platform_name}') + exit(1) + +binary_arch=get_machine_architecture() +platform_arch=get_computer_platform() + # Change to the home folder os.chdir(os.path.expanduser("~")) @@ -321,11 +343,11 @@ def install_mevboost(): global mevboost_version mevboost_version = response.json()['tag_name'] - # Search for the asset with the name that ends in linux_amd64.tar.gz + # Search for the asset with the name that ends in {platform_arch}_{binary_arch}.tar.gz assets = response.json()['assets'] download_url = None for asset in assets: - if asset['name'].endswith('linux_amd64.tar.gz'): + if asset['name'].endswith(f'{platform_arch.lower()}_{binary_arch}.tar.gz'): download_url = asset['browser_download_url'] break @@ -418,12 +440,21 @@ def download_and_install_nethermind(): global nethermind_version nethermind_version = response.json()['tag_name'] - # Search for the asset with the name that ends in linux-x64.zip + # Adjust binary name + if binary_arch == "amd64": + _arch="x64" + elif binary_arch == "arm64": + _arch="arm64" + else: + print("Error: Unknown binary architecture.") + exit(1) + + # Search for the asset with the name that ends in {platform_arch}-{_arch}.zip assets = response.json()['assets'] download_url = None zip_filename = None for asset in assets: - if asset['name'].endswith('linux-x64.zip'): + if asset['name'].endswith(f'{platform_arch.lower()}-{_arch}.zip'): download_url = asset['browser_download_url'] zip_filename = asset['name'] break @@ -504,11 +535,20 @@ def download_nimbus(): global nimbus_version nimbus_version = response.json()['tag_name'] - # Search for the asset with the name that ends in _Linux_amd64.tar.gz + # Adjust binary name + if binary_arch == "amd64": + _arch="amd64" + elif binary_arch == "arm64": + _arch="arm64v8" + else: + print("Error: Unknown binary architecture.") + exit(1) + + # Search for the asset appropriate for this system architecture and platform assets = response.json()['assets'] download_url = None for asset in assets: - if '_Linux_amd64' in asset['name'] and asset['name'].endswith('.tar.gz'): + if f'_{platform_arch}_{_arch}' in asset['name'] and asset['name'].endswith('.tar.gz'): download_url = asset['browser_download_url'] break @@ -532,7 +572,7 @@ def download_nimbus(): # Find the extracted folder extracted_folder = None for item in os.listdir(): - if item.startswith("nimbus-eth2_Linux_amd64"): + if item.startswith(f'nimbus-eth2_{platform.system()}_{_arch}'): extracted_folder = item break diff --git a/eth-duties.sh b/eth-duties.sh index 25e429a..bdd43bc 100755 --- a/eth-duties.sh +++ b/eth-duties.sh @@ -7,10 +7,27 @@ # # Made for home and solo stakers 🏠🥩 +# Base directory with scripts +BASE_DIR=$HOME/git/ethpillar + +# Load functions +source $BASE_DIR/functions.sh + +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + +# Binaries only available for amd64 +if [[ ! "${_arch}" == "amd64" ]]; then + echo "eth-duties binaries are only available for amd64 architecture" + sleep 5 + exit 1 +fi + # Variables GITHUB_URL=https://api.github.com/repos/TobiWo/eth-duties/releases/latest GITHUB_RELEASE_NODES=https://github.com/TobiWo/eth-duties/releases -RELEASE_SUFFIX="ubuntu2204-amd64.tar.gz" +RELEASE_SUFFIX="ubuntu2204-${_arch}.tar.gz" DESCRIPTION="eth-duties logs upcoming validator duties to the console. Developed mainly for home stakers." DOCUMENTATION=https://tobiwo.github.io/eth-duties SOURCE_CODE=https://github.com/TobiWo/eth-duties diff --git a/ethdo.sh b/ethdo.sh index 6bc14f9..87d89b4 100755 --- a/ethdo.sh +++ b/ethdo.sh @@ -7,10 +7,20 @@ # # Made for home and solo stakers 🏠🥩 +# Base directory with scripts +BASE_DIR=$HOME/git/ethpillar + +# Load functions +source $BASE_DIR/functions.sh + +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + # Variables GITHUB_URL=https://api.github.com/repos/wealdtech/ethdo/releases/latest GITHUB_RELEASE_NODES=https://github.com/wealdtech/ethdo/releases -RELEASE_SUFFIX="linux-amd64.tar.gz$" +RELEASE_SUFFIX="${_platform}-${_arch}.tar.gz$" DESCRIPTION="A command-line tool for managing common tasks in Ethereum" DOCUMENTATION=https://github.com/wealdtech/ethdo/blob/master/docs/howto.md SOURCE_CODE=https://github.com/wealdtech/ethdo @@ -32,7 +42,7 @@ function getLatestVersion(){ # Downloads latest release function downloadClient(){ - BINARIES_URL="$(curl -s $GITHUB_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep ${RELEASE_SUFFIX})" + BINARIES_URL="$(curl -s $GITHUB_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${RELEASE_SUFFIX})" echo Downloading URL: $BINARIES_URL cd $HOME # Download diff --git a/ethereum-metrics-exporter.sh b/ethereum-metrics-exporter.sh index e04a68a..4b32293 100755 --- a/ethereum-metrics-exporter.sh +++ b/ethereum-metrics-exporter.sh @@ -7,6 +7,15 @@ # # Made for home and solo stakers 🏠🥩 +BASE_DIR=$HOME/git/ethpillar + +# Load functions +source $BASE_DIR/functions.sh + +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + # Variables GITHUB_URL=https://api.github.com/repos/ethpandaops/ethereum-metrics-exporter/releases/latest GITHUB_RELEASE_NODES=https://github.com/ethpandaops/ethereum-metrics-exporter/releases @@ -18,12 +27,6 @@ ETHEREUM_METRICS_EXPORTER_OPTIONS=( GRAFANA_DIR=/etc/grafana PROMETHEUS_DIR=/etc/prometheus -function getNetworkConfig() { - ip_current=$(hostname --ip-address) - interface_current=$(ip route | grep default | head -1 | sed 's/.*dev \([^ ]*\) .*/\1/') - network_current="$(ip route | grep $interface_current | grep -v default | head -1 | awk '{print $1}')" -} - # Asks to update function upgradeBinaries(){ getLatestVersion @@ -48,7 +51,7 @@ function getLatestVersion(){ # Downloads latest release of ethereum-metrics-exporter function downloadClient(){ - BINARIES_URL="$(curl -s $GITHUB_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux_amd64.tar.gz$)" + BINARIES_URL="$(curl -s $GITHUB_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_platform}_${_arch}.tar.gz$)" echo Downloading URL: $BINARIES_URL cd $HOME # Download diff --git a/ethpillar.sh b/ethpillar.sh index ea07a70..327522d 100755 --- a/ethpillar.sh +++ b/ethpillar.sh @@ -12,7 +12,7 @@ # 🙌 Ask questions on Discord: # * https://discord.gg/dEpAVWgFNB -EP_VERSION="1.9.1" +EP_VERSION="2.0.0" # VARIABLES export BASE_DIR="$HOME/git/ethpillar" && cd $BASE_DIR @@ -32,6 +32,10 @@ API_BN_ENDPOINT="http://${CL_IP_ADDRESS}:${CL_REST_PORT}" # Execution layer RPC API EL_RPC_ENDPOINT="${EL_IP_ADDRESS}:${EL_RPC_PORT}" +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + menuMain(){ # Define the options for the main menu @@ -50,7 +54,7 @@ OPTIONS+=( 9 "Restart all clients" - "" 10 "System Administration" - 11 "Tools" + 11 "Toolbox" 99 "Quit" ) @@ -889,6 +893,8 @@ while true; do 1) # Skip if no validators installed if [[ ! -f /etc/systemd/system/validator.service ]]; then echo "No validator(s) installed. Press ENTER to continue."; read; break; fi + # Skip if arm64 + [[ "${_arch}" == "arm64" ]] && echo "eth-duties not available for arm64. Press ENTER to continue." && read && break # Install eth-duties if not yet installed if [[ ! -f /usr/local/bin/eth-duties ]]; then @@ -927,6 +933,7 @@ while true; do checkValidatorQueue ;; 9) + [[ "${_arch}" == "arm64" ]] && echo "EL Switcher not available for arm64. Press ENTER to continue." && read && break sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/coincashew/client-switcher/master/install.sh)" ;; 10) diff --git a/functions.sh b/functions.sh index f3a2978..f940e1c 100755 --- a/functions.sh +++ b/functions.sh @@ -75,6 +75,29 @@ network_isConnected() { sudo ip route get 1 2>/dev/null } +get_arch(){ + machine_arch="$(uname --machine)" + if [[ "${machine_arch}" = "x86_64" ]]; then + binary_arch="amd64" + elif [[ "${machine_arch}" = "aarch64" ]]; then + binary_arch="arm64" + else + echo "Unsupported architecture: ${machine_arch}" + exit 1 + fi + echo "${binary_arch}" +} + +get_platform(){ + platform="$(uname)" + if [[ "${platform}" = "Linux" ]]; then + echo "${platform}" + else + echo "Unsupported platform: ${platform}" + exit 1 + fi +} + print_node_info() { current_time=$(date) os_descrip=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g') diff --git a/install-nimbus-nethermind.sh b/install-nimbus-nethermind.sh index 668a1b7..ab42ef7 100755 --- a/install-nimbus-nethermind.sh +++ b/install-nimbus-nethermind.sh @@ -79,6 +79,22 @@ ohai() { printf "${tty_blue}==>${tty_bold} %s${tty_reset}\n" "$(shell_join "$@")" } +requirements_check() { + # Check CPU architecture + if ! [[ $(lscpu | grep -oE 'x86') || $(lscpu | grep -oE 'aarch64') ]]; then + echo "This machine's CPU architecture is not yet unsuppported." + echo "Recommend using Intel-AMD x86 or arm64 systems for best experience." + exit 1 + fi + + # Check operating system + if ! [[ "$(uname)" == "Linux" ]]; then + echo "This operating system is not yet unsuppported." + echo "Recommend installing Ubuntu Desktop 24.04+ LTS or Ubuntu Server 24.04+ LTS for best experience." + exit 1 + fi +} + linux_install_pre() { sudo apt-get update sudo apt-get install --no-install-recommends --no-install-suggests -y curl git ccze jq tmux bc @@ -123,6 +139,9 @@ linux_install_validator-install() { exit_on_error $? } +# Check OS and CPU requirements +requirements_check + # Do install. OS="$(uname)" if [[ "$OS" == "Linux" ]]; then diff --git a/install.sh b/install.sh index d44d494..c935716 100755 --- a/install.sh +++ b/install.sh @@ -78,9 +78,9 @@ ohai() { requirements_check() { # Check CPU architecture - if ! [[ $(lscpu | grep -oE 'x86') ]]; then + if ! [[ $(lscpu | grep -oE 'x86') || $(lscpu | grep -oE 'aarch64') ]]; then echo "This machine's CPU architecture is not yet unsuppported." - echo "Recommend using Intel or AMD x86 systems for best experience." + echo "Recommend using Intel-AMD x86 or arm64 systems for best experience." exit 1 fi @@ -94,7 +94,7 @@ requirements_check() { linux_install_pre() { sudo apt-get update - sudo apt-get install --no-install-recommends --no-install-suggests -y curl git ccze bc tmux jq + sudo apt-get install --no-install-recommends --no-install-suggests -y curl git ccze bc tmux jq nano btop exit_on_error $? } diff --git a/manage_validator_keys.sh b/manage_validator_keys.sh index 72f9f2d..a1e9a64 100755 --- a/manage_validator_keys.sh +++ b/manage_validator_keys.sh @@ -19,6 +19,10 @@ source $BASE_DIR/functions.sh # Load Lido CSM withdrawal address and fee recipient source $BASE_DIR/env +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + function downloadStakingDepositCLI(){ if [ -d $STAKING_DEPOSIT_CLI_DIR/staking-deposit-cli ]; then ohai "staking-deposit-tool already downloaded." @@ -30,9 +34,9 @@ function downloadStakingDepositCLI(){ #Setup variables RELEASE_URL="https://api.github.com/repos/ethereum/staking-deposit-cli/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux-amd64.tar.gz$)" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_platform}-${_arch}.tar.gz$)" BINARY_FILE="staking-deposit-cli.tar.gz" - + [[ -z $BINARIES_URL ]] && echo "Error: Unable to determine BINARIES URL" && exit 1 ohai "Downloading URL: $BINARIES_URL" # Dir to install staking-deposit-cli cd $STAKING_DEPOSIT_CLI_DIR @@ -43,7 +47,7 @@ function downloadStakingDepositCLI(){ # Cleanup rm staking-deposit-cli.tar.gz # Rename - mv staking_deposit-cli*amd64 staking-deposit-cli + mv staking_deposit-cli*${_arch} staking-deposit-cli cd staking-deposit-cli } @@ -236,7 +240,7 @@ function loadKeys(){ getLAUNCHPAD_URL queryValidatorQueue setLaunchPadMessage - whiptail --title "Next Steps: Upload JSON Deposit Data File" --msgbox "$MSG_LAUNCHPAD" 31 78 + whiptail --title "Next Steps: Upload JSON Deposit Data File" --msgbox "$MSG_LAUNCHPAD" 40 78 ohai "Finished loading keys. Press enter to continue." read promptViewLogs @@ -251,7 +255,10 @@ function setLaunchPadMessage(){ \n5) Wait for validators to become active. $MSG_VALIDATOR_QUEUE \nTips: \n - Wait for Node Sync: Before making a deposit, ensure your EL/CL client is synced to avoid missing rewards. -\n - Timing of Validator Activation: After depositing, it takes about 15 hours for a validator to be activated unless there's a long entry queue." +\n - Timing of Validator Activation: After depositing, it takes about 15 hours for a validator to be activated unless there's a long entry queue. +\n - Backup Keystores: For faster recovery, keep copies of the keystore files on offline USB storage. +\n Location: ~/staking-deposit-cli/$(basename $KEYFOLDER) +\n - Cleanup Keystores: Delete keystore files from node after backup." MSG_LAUNCHPAD_LIDO="1) Visit Lido CSM: $LAUNCHPAD_URL_LIDO \n2) Connect your wallet on the correct network, review and accept terms. @@ -263,7 +270,10 @@ cat ~/staking-deposit-cli/$(basename $KEYFOLDER)/deposit*json \nTips: \n - DO NOT DEPOSIT 32ETH YOURSELF: Lido will handle the validator deposit for you. \n - Wait for Node Sync: Before making the ~2ETH bond deposit, ensure your EL/CL client is synced to avoid missing rewards. -\n - Timing of Validator Activation: After depositing, it takes about 15 hours for a validator to be activated unless there's a long entry queue." +\n - Timing of Validator Activation: After depositing, it takes about 15 hours for a validator to be activated unless there's a long entry queue. +\n - Backup Keystores: For faster recovery, keep copies of the keystore files on offline USB storage. +\n Location: ~/staking-deposit-cli/$(basename $KEYFOLDER) +\n - Cleanup Keystores: Delete keystore files from node after backup." if [[ $(grep -oE "${CSM_FEE_RECIPIENT_ADDRESS}" /etc/systemd/system/validator.service) ]]; then # Update message for Lido MSG_LAUNCHPAD="${MSG_LAUNCHPAD_LIDO}" diff --git a/update_consensus.sh b/update_consensus.sh index 02e1e0f..c8ddd65 100755 --- a/update_consensus.sh +++ b/update_consensus.sh @@ -12,6 +12,10 @@ BASE_DIR=$HOME/git/ethpillar # Load functions source $BASE_DIR/functions.sh +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + function promptYesNo(){ if whiptail --title "Update ${CLIENT}" --yesno "Installed Version is: $VERSION\nLatest Version is: $TAG\n\nReminder: Always read the release notes for breaking changes: $CHANGES_URL\n\nDo you want to update $CLIENT to $TAG?" 15 78; then updateClient @@ -63,8 +67,9 @@ function getLatestVersion(){ function updateClient(){ case "$CLIENT" in Lighthouse) + [[ "${_arch}" == "amd64" ]] && _architecture="x86_64" || _architecture="aarch64" RELEASE_URL="https://api.github.com/repos/sigp/lighthouse/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep x86_64-unknown-linux-gnu.tar.gz$)" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_architecture}-unknown-${_platform}-gnu.tar.gz$)" echo Downloading URL: $BINARIES_URL cd $HOME wget -O lighthouse.tar.gz $BINARIES_URL @@ -84,7 +89,7 @@ function updateClient(){ Lodestar) RELEASE_URL="https://api.github.com/repos/ChainSafe/lodestar/releases/latest" LATEST_TAG="$(curl -s $RELEASE_URL | jq -r ".tag_name")" - BINARIES_URL="https://github.com/ChainSafe/lodestar/releases/download/${LATEST_TAG}/lodestar-${LATEST_TAG}-linux-amd64.tar.gz" + BINARIES_URL="https://github.com/ChainSafe/lodestar/releases/download/${LATEST_TAG}/lodestar-${LATEST_TAG}-${_platform}-${_arch}.tar.gz" echo Downloading URL: $BINARIES_URL cd $HOME wget -O lodestar.tar.gz $BINARIES_URL @@ -103,6 +108,7 @@ function updateClient(){ test -f /etc/systemd/system/validator.service && sudo service validator start ;; Teku) + [[ "${_arch}" == "arm64" ]] && echo "Teku binaries not available for arm64. Press ENTER to continue." && read && break RELEASE_URL="https://api.github.com/repos/ConsenSys/teku/releases/latest" LATEST_TAG="$(curl -s $RELEASE_URL | jq -r ".tag_name")" BINARIES_URL="https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/${LATEST_TAG}/teku-${LATEST_TAG}.tar.gz" @@ -125,7 +131,7 @@ function updateClient(){ ;; Nimbus) RELEASE_URL="https://api.github.com/repos/status-im/nimbus-eth2/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep "_Linux_amd64.*.tar.gz$")" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case "_${_platform}_${_arch}.*.tar.gz$")" echo Downloading URL: $BINARIES_URL cd $HOME wget -O nimbus.tar.gz $BINARIES_URL @@ -134,7 +140,7 @@ function updateClient(){ exit 1 fi tar -xzvf nimbus.tar.gz -C $HOME - mv nimbus-eth2_Linux_amd64_* nimbus + mv nimbus-eth2_${_platform}_${_arch}* nimbus test -f /etc/systemd/system/consensus.service && sudo systemctl stop consensus test -f /etc/systemd/system/validator.service && sudo service validator stop sudo rm /usr/local/bin/nimbus_beacon_node @@ -149,8 +155,10 @@ function updateClient(){ Prysm) cd $HOME prysm_version=$(curl -f -s https://prysmaticlabs.com/releases/latest) - file_beacon=beacon-chain-${prysm_version}-linux-amd64 - file_validator=validator-${prysm_version}-linux-amd64 + # Convert to lower case + _platform=$(echo ${_platform} | tr '[:upper:]' '[:lower:]') + file_beacon=beacon-chain-${prysm_version}-${_platform}-${_arch} + file_validator=validator-${prysm_version}-${_platform}-${_arch} curl -f -L "https://prysmaticlabs.com/releases/${file_beacon}" -o beacon-chain curl -f -L "https://prysmaticlabs.com/releases/${file_validator}" -o validator chmod +x beacon-chain validator diff --git a/update_execution.sh b/update_execution.sh index 6b42fa6..f1ad0df 100755 --- a/update_execution.sh +++ b/update_execution.sh @@ -12,6 +12,10 @@ BASE_DIR=$HOME/git/ethpillar # Load functions source $BASE_DIR/functions.sh +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + function getCurrentVersion(){ EL_INSTALLED=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":2}' ${EL_RPC_ENDPOINT} | jq '.result') #Find version in format #.#.# @@ -69,8 +73,9 @@ function getLatestVersion(){ function updateClient(){ case $EL in Nethermind) + [[ "${_arch}" == "amd64" ]] && _architecture="x64" || _architecture="arm64" RELEASE_URL="https://api.github.com/repos/NethermindEth/nethermind/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux-x64)" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_platform}-${_architecture})" echo Downloading URL: $BINARIES_URL cd $HOME wget -O nethermind.zip $BINARIES_URL @@ -82,8 +87,9 @@ function updateClient(){ sudo systemctl start execution ;; Besu) + [[ "${_arch}" == "arm64" ]] && echo "Besu binaries not available for arm64. Press ENTER to continue." && read && break updateBesuJRE - RELEASE_URL="https://api.github.com/repos/hyperledger/besu/releases/latest" + RELEASE_URL="https://api.github.com/repos/hyperledger/besu/releases/latest" TAG=$(curl -s $RELEASE_URL | jq -r .tag_name) BINARIES_URL="https://github.com/hyperledger/besu/releases/download/$TAG/besu-$TAG.tar.gz" echo Downloading URL: $BINARIES_URL @@ -99,7 +105,7 @@ function updateClient(){ ;; Erigon) RELEASE_URL="https://api.github.com/repos/ledgerwatch/erigon/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux_amd64)" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_platform}_${_arch})" echo Downloading URL: $BINARIES_URL cd $HOME wget -O erigon.tar.gz $BINARIES_URL @@ -110,8 +116,10 @@ function updateClient(){ rm erigon.tar.gz README.md ;; Geth) + # Convert to lower case + _platform=$(echo ${_platform} | tr '[:upper:]' '[:lower:]') RELEASE_URL="https://geth.ethereum.org/downloads" - FILE="https://gethstore.blob.core.windows.net/builds/geth-linux-amd64[a-zA-Z0-9./?=_%:-]*.tar.gz" + FILE="https://gethstore.blob.core.windows.net/builds/geth-${_platform}-${_arch}[a-zA-Z0-9./?=_%:-]*.tar.gz" BINARIES_URL="$(curl -s $RELEASE_URL | grep -Eo $FILE | head -1)" echo Downloading URL: $BINARIES_URL cd $HOME @@ -123,9 +131,12 @@ function updateClient(){ rm geth.tar.gz COPYING ;; Reth) + # Convert to lower case + _platform=$(echo ${_platform} | tr '[:upper:]' '[:lower:]') + [[ "${_arch}" == "amd64" ]] && _architecture="x86_64" || _architecture="aarch64" RELEASE_URL="https://api.github.com/repos/paradigmxyz/reth/releases/latest" TAG=$(curl -s $RELEASE_URL | jq -r .tag_name) - BINARIES_URL="https://github.com/paradigmxyz/reth/releases/download/$TAG/reth-$TAG-x86_64-unknown-linux-gnu.tar.gz" + BINARIES_URL="https://github.com/paradigmxyz/reth/releases/download/$TAG/reth-$TAG-${_architecture}-unknown-${_platform}-gnu.tar.gz" echo Downloading URL: $BINARIES_URL cd $HOME wget -O reth.tar.gz $BINARIES_URL diff --git a/update_mevboost.sh b/update_mevboost.sh index f958373..973499c 100755 --- a/update_mevboost.sh +++ b/update_mevboost.sh @@ -12,6 +12,10 @@ BASE_DIR=$HOME/git/ethpillar # Load functions source $BASE_DIR/functions.sh +# Get machine info +_platform=$(get_platform) +_arch=$(get_arch) + function getCurrentVersion(){ INSTALLED=$(mev-boost --version) #Find version in format #.#.# @@ -44,7 +48,7 @@ function getLatestVersion(){ function updateClient(){ RELEASE_URL="https://api.github.com/repos/flashbots/mev-boost/releases/latest" - BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux_amd64.tar.gz$)" + BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep --ignore-case ${_platform}_${_arch}.tar.gz$)" echo Downloading URL: $BINARIES_URL