haveno_deps.sh: hashes, tag and version constants on top (#231)

This commit is contained in:
erciccione 2022-02-06 17:09:08 +00:00 committed by GitHub
parent 3552fb77bd
commit a5f834cc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,14 @@
#!/bin/bash
# Hashes and tag of our Monero testing binaries at https://github.com/haveno-dex/monero/releases
MONERO_HASH_MAC="648ea261ffe20857bd05a645245df05be7b01e678861854ce711ea6d6dcebc4c"
MONERO_HASH_LINUX="72f31a4a1858730387beb8c3688e868fc22a8df534e616cb94af9e1b76f2450a"
MONERO_TAG="testing3"
# Hashes and version of bitcoin core: https://bitcoin.org/bin/
BTC_HASH_MAC="1ea5cedb64318e9868a66d3ab65de14516f9ada53143e460d50af428b5aec3c7"
BTC_HASH_LINUX="366eb44a7a0aa5bd342deea215ec19a184a11f2ca22220304ebb20b9c8917e2b"
BTC_VERSION=0.21.1
is_mac() {
if [[ "$OSTYPE" == "darwin"* ]]; then
return 0
@ -32,9 +41,9 @@ dw_source() {
# Verify Monero hash
check_monero() {
if is_mac; then
shasum -a 256 -c <<<'648ea261ffe20857bd05a645245df05be7b01e678861854ce711ea6d6dcebc4c *monero-bins-haveno-'"${platform}"'.tar.gz' || exit 1
shasum -a 256 -c <<< ''"${MONERO_HASH_MAC}"' *monero-bins-haveno-'"${platform}"'.tar.gz' || exit 1
else
echo "72f31a4a1858730387beb8c3688e868fc22a8df534e616cb94af9e1b76f2450a monero-bins-haveno-${platform}.tar.gz" | sha256sum -c || exit 1
echo "${MONERO_HASH_LINUX} monero-bins-haveno-${platform}.tar.gz" | sha256sum -c || exit 1
fi
echo "-> Monero binaries downloaded and verified"
@ -43,9 +52,9 @@ check_monero() {
# Verify hashes of bitcoind and bitcoin-cli
check_bitcoin() {
if is_mac; then
shasum -a 256 -c <<<'1ea5cedb64318e9868a66d3ab65de14516f9ada53143e460d50af428b5aec3c7 *bitcoin-'"${btcversion}"'-'"${btc_platform}"'.tar.gz' || exit 1
shasum -a 256 -c <<< ''"${BTC_HASH_MAC}"' *bitcoin-'"${BTC_VERSION}"'-'"${btc_platform}"'.tar.gz' || exit 1
else
echo "366eb44a7a0aa5bd342deea215ec19a184a11f2ca22220304ebb20b9c8917e2b bitcoin-${btcversion}-${btc_platform}.tar.gz" | sha256sum -c || exit 1
echo "${BTC_HASH_LINUX} bitcoin-${BTC_VERSION}-${btc_platform}.tar.gz" | sha256sum -c || exit 1
fi
echo "-> Bitcoin binaries downloaded and verified"
@ -62,7 +71,7 @@ dw_monero() {
if [ -f monero-bins-haveno-${platform}.tar.gz ]; then
check_monero
else
dw_source https://github.com/haveno-dex/monero/releases/download/testing3/monero-bins-haveno-${platform}.tar.gz || { echo "! something went wrong while downloading the Monero binaries. Exiting..."; exit 1; } && \
dw_source https://github.com/haveno-dex/monero/releases/download/${MONERO_TAG}/monero-bins-haveno-${platform}.tar.gz || { echo "! something went wrong while downloading the Monero binaries. Exiting..."; exit 1; } && \
check_monero
fi
@ -72,24 +81,22 @@ dw_monero() {
# Download Bitcoin bins
dw_bitcoin() {
btcversion=0.21.1
if is_mac; then
btc_platform="osx64"
else
btc_platform="x86_64-linux-gnu"
fi
if [ -f bitcoin-${btcversion}-${btc_platform}.tar.gz ]; then
if [ -f bitcoin-${BTC_VERSION}-${btc_platform}.tar.gz ]; then
check_bitcoin
else
dw_source https://bitcoin.org/bin/bitcoin-core-${btcversion}/bitcoin-${btcversion}-${btc_platform}.tar.gz || { echo "! something went wrong while downloading the Bitcoin binaries. Exiting..."; exit 1; } && \
dw_source https://bitcoin.org/bin/bitcoin-core-${BTC_VERSION}/bitcoin-${BTC_VERSION}-${btc_platform}.tar.gz || { echo "! something went wrong while downloading the Bitcoin binaries. Exiting..."; exit 1; } && \
check_bitcoin
fi
tar -xzf bitcoin-${btcversion}-${btc_platform}.tar.gz && \
cp bitcoin-${btcversion}/bin/{bitcoin-cli,bitcoind} . && \
rm -r bitcoin-${btcversion} || exit 1
tar -xzf bitcoin-${BTC_VERSION}-${btc_platform}.tar.gz && \
cp bitcoin-${BTC_VERSION}/bin/{bitcoin-cli,bitcoind} . && \
rm -r bitcoin-${BTC_VERSION} || exit 1
}