mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-20 04:37:19 +02:00
Bitcoin update RC support (#2205)
This commit is contained in:
@@ -278,13 +278,19 @@ bitcoinUpdate() {
|
|||||||
if [ ${bitcoinUpdateInstalled} -eq 0 ]; then
|
if [ ${bitcoinUpdateInstalled} -eq 0 ]; then
|
||||||
OPTIONS+=(TESTED "Optional Bitcoin Core update to ${bitcoinVersion}")
|
OPTIONS+=(TESTED "Optional Bitcoin Core update to ${bitcoinVersion}")
|
||||||
fi
|
fi
|
||||||
if [ $installedVersion != $bitcoinLatestVersion ];then
|
if [ $installedVersion != $bitcoinLatestVersion ]&&[ ${bitcoinVersion} != ${bitcoinLatestVersion} ];then
|
||||||
OPTIONS+=(RECKLESS "Untested Bitcoin Core update to ${bitcoinLatestVersion}")
|
OPTIONS+=(RECKLESS "Untested Bitcoin Core update to ${bitcoinLatestVersion}")
|
||||||
fi
|
fi
|
||||||
OPTIONS+=(CUSTOM "Update Bitcoin Core to a chosen version")
|
OPTIONS+=(CUSTOM "Update Bitcoin Core to a chosen version")
|
||||||
CHOICE=$(whiptail --clear --title "Update Bitcoin Core Options" --menu "" 9 60 3 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "" \
|
||||||
|
--title "Bitcoin Core Update Options" \
|
||||||
|
--ok-label "Select" \
|
||||||
|
--cancel-label "Back" \
|
||||||
|
--menu "" \
|
||||||
|
9 60 3 \
|
||||||
|
"${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
clear
|
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
TESTED)
|
TESTED)
|
||||||
if [ ${bitcoinUpdateInstalled} -eq 1 ]; then
|
if [ ${bitcoinUpdateInstalled} -eq 1 ]; then
|
||||||
|
@@ -26,7 +26,6 @@ bitcoinVersion="0.21.0"
|
|||||||
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
|
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
|
||||||
|
|
||||||
# GATHER DATA
|
# GATHER DATA
|
||||||
|
|
||||||
# setting download directory
|
# setting download directory
|
||||||
downloadDir="/home/admin/download"
|
downloadDir="/home/admin/download"
|
||||||
|
|
||||||
@@ -89,6 +88,7 @@ if [ "${mode}" = "tested" ]; then
|
|||||||
echo "# OK - update version is matching"
|
echo "# OK - update version is matching"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
pathVersion=${bitcoinVersion}
|
||||||
|
|
||||||
elif [ "${mode}" = "reckless" ]; then
|
elif [ "${mode}" = "reckless" ]; then
|
||||||
# RECKLESS
|
# RECKLESS
|
||||||
@@ -97,20 +97,31 @@ elif [ "${mode}" = "reckless" ]; then
|
|||||||
# it will always pick the latest release from the github
|
# it will always pick the latest release from the github
|
||||||
echo "# bitcoin.update.sh reckless"
|
echo "# bitcoin.update.sh reckless"
|
||||||
bitcoinVersion=${bitcoinLatestVersion}
|
bitcoinVersion=${bitcoinLatestVersion}
|
||||||
|
pathVersion=${bitcoinVersion}
|
||||||
|
|
||||||
elif [ "${mode}" = "custom" ]; then
|
elif [ "${mode}" = "custom" ]; then
|
||||||
|
clear
|
||||||
echo
|
echo
|
||||||
echo "# Update Bitcoin Core to a chosen version."
|
echo "# Update Bitcoin Core to a chosen version."
|
||||||
echo
|
echo
|
||||||
echo "# Input the version you would like to install and press ENTER."
|
echo "# Input the version you would like to install and press ENTER."
|
||||||
echo "# For example:"
|
echo "# Examples:"
|
||||||
|
echo "0.21.1rc1"
|
||||||
echo "0.21.0"
|
echo "0.21.0"
|
||||||
echo
|
echo
|
||||||
read bitcoinVersion
|
read bitcoinVersion
|
||||||
|
if [ $(echo ${bitcoinVersion} | grep -c "rc") -gt 0 ];then
|
||||||
|
cutVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $1}')
|
||||||
|
rcVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $2}')
|
||||||
|
pathVersion=${cutVersion}/test.r${rcVersion}
|
||||||
|
else
|
||||||
|
pathVersion=${bitcoinVersion}
|
||||||
|
fi
|
||||||
|
|
||||||
if curl --output /dev/null --silent --head --fail \
|
if curl --output /dev/null --silent --head --fail \
|
||||||
https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc; then
|
https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS.asc; then
|
||||||
echo "# OK version exists"
|
echo "# OK version exists at https://bitcoincore.org/bin/bitcoin-core-${pathVersion}"
|
||||||
echo "# Press ENTER to proceed to install Bitcoin Core $bitcoinVersion, CTRL+C to abort."
|
echo "# Press ENTER to proceed to install Bitcoin Core $bitcoinVersion or CTRL+C to abort."
|
||||||
read key
|
read key
|
||||||
else
|
else
|
||||||
echo "# FAIL $bitcoinVersion does not exist"
|
echo "# FAIL $bitcoinVersion does not exist"
|
||||||
@@ -157,7 +168,7 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
|||||||
gpg --import ./laanwj-releases.asc
|
gpg --import ./laanwj-releases.asc
|
||||||
|
|
||||||
# download signed binary sha256 hash sum file and check
|
# download signed binary sha256 hash sum file and check
|
||||||
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc
|
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS.asc
|
||||||
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
||||||
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
||||||
echo "goodSignature(${goodSignature})"
|
echo "goodSignature(${goodSignature})"
|
||||||
@@ -181,14 +192,14 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
|||||||
|
|
||||||
# download resources
|
# download resources
|
||||||
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
||||||
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName}
|
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName}
|
||||||
if [ ! -f "./${binaryName}" ]
|
if [ ! -f "./${binaryName}" ]
|
||||||
then
|
then
|
||||||
echo "# !!! FAIL !!! Downloading BITCOIN BINARY did not succeed."
|
echo "# !!! FAIL !!! Downloading BITCOIN BINARY did not succeed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check binary checksum test
|
echo "# Checking binary checksum ..."
|
||||||
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
|
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
|
||||||
if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then
|
if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then
|
||||||
echo "!!! FAIL !!! Downloaded BITCOIN BINARY not matching SHA256 checksum: ${bitcoinSHA256}"
|
echo "!!! FAIL !!! Downloaded BITCOIN BINARY not matching SHA256 checksum: ${bitcoinSHA256}"
|
||||||
@@ -212,7 +223,7 @@ fi
|
|||||||
if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom" ];then
|
if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom" ];then
|
||||||
|
|
||||||
# install
|
# install
|
||||||
echo "# Stopping bitcoind and lnd"
|
echo "# Stopping bitcoind and lnd ..."
|
||||||
sudo systemctl stop lnd
|
sudo systemctl stop lnd
|
||||||
sudo systemctl stop bitcoind
|
sudo systemctl stop bitcoind
|
||||||
echo
|
echo
|
||||||
@@ -234,18 +245,20 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
|||||||
sudo sed -i "s/^bitcoinInterimsUpdate=.*/bitcoinInterimsUpdate='${bitcoinInterimsUpdateNew}'/g" /mnt/hdd/raspiblitz.conf
|
sudo sed -i "s/^bitcoinInterimsUpdate=.*/bitcoinInterimsUpdate='${bitcoinInterimsUpdateNew}'/g" /mnt/hdd/raspiblitz.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "# OK Bitcoin Core ${bitcoinVersion} is installed"
|
||||||
if [ "${state}" == "ready" ]; then
|
if [ "${state}" == "ready" ]; then
|
||||||
sudo systemctl start bitcoind
|
sudo systemctl start bitcoind
|
||||||
sudo systemctl start lnd
|
sudo systemctl start lnd
|
||||||
|
echo
|
||||||
|
echo "# Restarted LND"
|
||||||
|
echo "# Use: 'lncli unlock' to unlock the LND wallet once Bitcoin Core is synced"
|
||||||
|
echo
|
||||||
|
echo "# Press ENTER to exit to the menu ..."
|
||||||
|
read key
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
echo "# OK Bitcoin Core Installed"
|
|
||||||
echo "# NOTE: RaspiBlitz may need to reboot now"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "# error='parameter not known'"
|
echo "# error='parameter not known'"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user