Skip to content

Commit

Permalink
Merge pull request #99 from eosnetworkfoundation/zach-leap-dl
Browse files Browse the repository at this point in the history
Support Spring Pre-Release Package Downloads
  • Loading branch information
kj4ezj authored Jul 27, 2024
2 parents 565ce67 + 7483f19 commit 36e6836
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions replay-client/install-nodeos.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
#!/usr/bin/env bash
#!/bin/bash
set -eo pipefail

# install nodeos locally

LEAP_VERSION="${1}"
# install nodeos locally
LEAP_VERSION="${1#v}"
OS="ubuntu22.04"
v4_DEB_FILE="leap_""${LEAP_VERSION}"-"${OS}""_amd64.deb"
v5_DEB_FILE="leap_""${LEAP_VERSION}""_amd64.deb"
if [ ${LEAP_VERSION:0:1} == "4" ]; then
DEB_URL="https://github.com/AntelopeIO/leap/releases/download/v""${LEAP_VERSION}"/"${v4_DEB_FILE}"
DEB_FILE=${v4_DEB_FILE}
else
DEB_URL="https://github.com/AntelopeIO/leap/releases/download/v""${LEAP_VERSION}"/"${v5_DEB_FILE}"
DEB_FILE=${v5_DEB_FILE}
if [[ "${LEAP_VERSION:0:1}" == '4' ]]; then
DEB_FILE="leap_${LEAP_VERSION}-${OS}_amd64.deb"
DEB_URL="https://github.com/AntelopeIO/leap/releases/download/v${LEAP_VERSION}/${DEB_FILE}"
elif [[ "${LEAP_VERSION:0:1}" == '5' ]]; then
DEB_FILE="leap_${LEAP_VERSION}_amd64.deb"
DEB_URL="https://github.com/AntelopeIO/leap/releases/download/v${LEAP_VERSION}/${DEB_FILE}"
else # spring
DEB_FILE="antelope-spring_${LEAP_VERSION}-${OS}_amd64.deb"
DEB_URL="https://github.com/AntelopeIO/spring/releases/download/v${LEAP_VERSION}/${DEB_FILE}"
fi

## dry-run
[[ "$(echo "$2" | grep -icP '^DRY(-_)>RUN$')" == '1' ]] && export DRY_RUN='true'
if [[ "${DRY_RUN}" == 'true' ]]; then
prinf "\e[1;33mWARNING: DRY-RUN is set!\e[0m\n"
echo "LEAP_VERSION='${LEAP_VERSION}'"
echo "OS='${OS}'"
echo "DEB_FILE='${DEB_FILE}'"
echo "DEB_URL='${DEB_URL}'"
echo "Exiting... - ${BASH_SOURCE[0]}"
exit 0
fi

## root setup ##
# clean out un-needed files
for not_needed_deb_file in "${HOME:?}"/leap_*.deb
do
if [ "${not_needed_deb_file}" != "${HOME:?}"/"${DEB_FILE}" ]; then
echo "Removing not needed deb ${not_needed_deb_file}"
rm -rf ${not_needed_deb_file}
fi
for not_needed_deb_file in "${HOME:?}"/leap_*.deb; do
if [ "${not_needed_deb_file}" != "${HOME:?}/${DEB_FILE}" ]; then
echo "Removing not needed deb ${not_needed_deb_file}"
rm -rf "${not_needed_deb_file}"
fi
done

# download file if needed
if [ ! -f "${HOME:?}"/"${DEB_FILE}" ]; then
wget --directory-prefix=${HOME} "${DEB_URL}" 2> /dev/null
if [ ! -f "${HOME:?}/${DEB_FILE}" ]; then
wget --directory-prefix="${HOME}" "${DEB_URL}" 2> /dev/null
fi

# install nodeos locally
echo "Installing nodeos ${LEAP_VERSION} locally"
[ -d "${HOME:?}"/nodeos ] && rm -rf "${HOME:?}"/nodeos
mkdir "${HOME:?}"/nodeos
dpkg -x "${HOME:?}"/"${DEB_FILE}" "${HOME:?}"/nodeos
[ -d "${HOME:?}/nodeos" ] && rm -rf "${HOME:?}/nodeos"
mkdir "${HOME:?}/nodeos"
dpkg -x "${HOME:?}/${DEB_FILE}" "${HOME:?}/nodeos"

echo "Done. - ${BASH_SOURCE[0]}"

0 comments on commit 36e6836

Please sign in to comment.