#!/bin/sh
sudo systemctl stop bitcoind
cd /tmp
VERSION="27.1"
sudo wget https://bitcoincore.org/bin/bitcoin-core-$VERSION/bitcoin-$VERSION-aarch64-linux-gnu.tar.gz
sudo wget https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS
sudo wget https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS.asc
sudo sha256sum --ignore-missing --check SHA256SUMS
sudo curl -s "https://api.github.com/repositories/355107265/contents/builder-keys" | grep download_url | grep -oE "https://[a-zA-Z0-9./-]+" | while read url; do curl -s "$url" | gpg --import; done
gpg --verify SHA256SUMS.asc
sudo tar -xvf bitcoin-$VERSION-aarch64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-$VERSION/bin/*
sudo systemctl start bitcoind
rm bitcoin_upgrade.sh
