deps: updates scripts/haveno_deps.sh

- don't overwrite monerod and monero-wallet-rpc if correct archive already downloaded (fixes #239)
- delete old monero bins archive and download if checksum doesn't match (fixes #301)
This commit is contained in:
erciccione 2022-05-12 13:22:52 +02:00 committed by woodser
parent ffccf83ac5
commit 052180eed7

View File

@ -41,12 +41,10 @@ dw_source() {
# Verify Monero hash # Verify Monero hash
check_monero() { check_monero() {
if is_mac; then if is_mac; then
shasum -a 256 -c <<< ''"${MONERO_HASH_MAC}"' *monero-bins-haveno-'"${platform}"'.tar.gz' || exit 1 shasum -a 256 -c <<< ''"${MONERO_HASH_MAC}"' *monero-bins-haveno-'"${platform}"'.tar.gz' || return 1
else else
echo "${MONERO_HASH_LINUX} monero-bins-haveno-${platform}.tar.gz" | sha256sum -c || exit 1 echo "${MONERO_HASH_LINUX} monero-bins-haveno-${platform}.tar.gz" | sha256sum -c || return 1
fi fi
echo "-> Monero binaries downloaded and verified"
} }
# Verify hashes of bitcoind and bitcoin-cli # Verify hashes of bitcoind and bitcoin-cli
@ -62,21 +60,37 @@ check_bitcoin() {
# Download Monero bins # Download Monero bins
dw_monero() { dw_monero() {
extract_monero() {
echo "-> extracting monerod and monero-wallet-rpc from archive" && \
tar -xzf "monero-bins-haveno-${platform}.tar.gz" && \
chmod +x {monerod,monero-wallet-rpc} || exit 1
}
if is_mac; then if is_mac; then
platform="mac" platform="mac"
else else
platform="linux" platform="linux"
fi fi
if [ -f monero-bins-haveno-${platform}.tar.gz ]; then if [ -f "monero-bins-haveno-${platform}.tar.gz" ]; then
check_monero if check_monero; then
else echo "-> Correct Monero archive already downloaded"
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; } && \ if [ ! -f "monerod" ] || [ ! -f "monero-wallet-rpc" ]; then
check_monero extract_monero
fi
else
echo "-> Monero archive found but outdated or corrupted. Downloading it again..." && \
rm monero-bins-haveno-${platform}.tar.gz && \
dw_source https://github.com/haveno-dex/monero/releases/download/${MONERO_TAG}/monero-bins-haveno-${platform}.tar.gz && \
check_monero && \
extract_monero
fi
else
dw_source https://github.com/haveno-dex/monero/releases/download/${MONERO_TAG}/monero-bins-haveno-${platform}.tar.gz && \
check_monero && \
extract_monero
fi fi
tar -xzf monero-bins-haveno-${platform}.tar.gz && \
chmod +x {monerod,monero-wallet-rpc} || exit 1
} }
# Download Bitcoin bins # Download Bitcoin bins
@ -99,7 +113,6 @@ dw_bitcoin() {
rm -r bitcoin-${BTC_VERSION} || exit 1 rm -r bitcoin-${BTC_VERSION} || exit 1
} }
while true; do while true; do
cd .localnet cd .localnet