unlock LND after Bitcoin Core install if ready (#2214)

* unlock LND after Bitcoin Core install if ready
* bitcoin.update: improve output and comments
This commit is contained in:
openoms
2021-04-23 23:19:26 +01:00
committed by GitHub
parent b1d6384407
commit 87e297a3cf

View File

@@ -2,15 +2,15 @@
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "Interim optional Bitcoin Core updates between RaspiBlitz releases." echo "Interim optional Bitcoin Core updates between RaspiBlitz releases."
echo "bitcoin.update.sh [info|tested|reckless|custom]" echo "bitcoin.update.sh [info|tested|reckless|custom]"
echo "info -> get actual state and possible actions" echo "info -> get actual state and possible actions"
echo "tested -> only do a tested update by the RaspiBlitz team" echo "tested -> only do a tested update by the RaspiBlitz team"
echo "reckless -> the update was not tested by the RaspiBlitz team" echo "reckless -> the update was not tested by the RaspiBlitz team"
echo "custom -> update to a chosen version" echo "custom -> update to a chosen version"
echo " the binary will be checked by signature and checksum in all cases" echo " the binary will be checked by signature and checksum in all cases"
echo echo
exit 1 exit 1
fi fi
source /home/admin/raspiblitz.info source /home/admin/raspiblitz.info
@@ -156,9 +156,9 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
echo "# !!! FAIL !!! Download laanwj-releases.asc not success." echo "# !!! FAIL !!! Download laanwj-releases.asc not success."
exit 1 exit 1
fi fi
gpg ./laanwj-releases.asc gpg --import-options show-only --import ./laanwj-releases.asc
fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep "${laanwjPGP}" -c) fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep -c "${laanwjPGP}")
if [ ${fingerprint} -lt 1 ]; then if [ ${fingerprint} -eq 0 ]; then
echo echo
echo "# !!! BUILD WARNING --> Bitcoin PGP author not as expected" echo "# !!! BUILD WARNING --> Bitcoin PGP author not as expected"
echo "# Should contain laanwjPGP: ${laanwjPGP}" echo "# Should contain laanwjPGP: ${laanwjPGP}"
@@ -184,13 +184,7 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
echo echo
fi fi
# get the sha256 value for the corresponding platform from signed hash sum file echo "# Downloading Bitcoin Core v${bitcoinVersion} for ${bitcoinOSversion} ..."
bitcoinSHA256=$(grep -i "$bitcoinOSversion" SHA256SUMS.asc | cut -d " " -f1)
echo
echo "# BITCOIN v${bitcoinVersion} for ${bitcoinOSversion}"
# download resources
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz" binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName} sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName}
if [ ! -f "./${binaryName}" ] if [ ! -f "./${binaryName}" ]
@@ -200,26 +194,31 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
fi fi
echo "# Checking binary checksum ..." echo "# Checking binary checksum ..."
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) checksumTest=$(sha256sum -c --ignore-missing SHA256SUMS.asc ${binaryName} 2>/dev/null \
if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then | grep -c "${binaryName}: OK")
echo "!!! FAIL !!! Downloaded BITCOIN BINARY not matching SHA256 checksum: ${bitcoinSHA256}" if [ "${checksumTest}" -eq 0 ]; then
# get the sha256 value for the corresponding platform from signed hash sum file
bitcoinSHA256=$(grep -i "$bitcoinOSversion" SHA256SUMS.asc | cut -d " " -f1)
echo "!!! FAIL !!! Downloaded BITCOIN BINARY CHECKSUM:"
echo "$(sha256sum ${binaryName})"
echo "NOT matching SHA256 checksum:"
echo "${bitcoinSHA256}"
exit 1 exit 1
else else
echo echo
echo "# OK --> VERIFIED BITCOIN CHECKSUM CORRECT" echo "# OK --> VERIFIED BITCOIN CHECKSUM IS CORRECT"
echo echo
fi fi
fi fi
if [ "${mode}" = "tested" ]||[ "${mode}" = "custom" ]; then if [ "${mode}" = "tested" ]||[ "${mode}" = "custom" ]; then
# note: install will be done the same as reckless further down
bitcoinInterimsUpdateNew="${bitcoinVersion}" bitcoinInterimsUpdateNew="${bitcoinVersion}"
elif [ "${mode}" = "reckless" ]; then elif [ "${mode}" = "reckless" ]; then
bitcoinInterimsUpdateNew="reckless" bitcoinInterimsUpdateNew="reckless"
fi fi
# JOINED INSTALL (tested & RECKLESS) # JOINED INSTALL
if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom" ];then if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom" ];then
# install # install
@@ -247,14 +246,18 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
echo "# OK Bitcoin Core ${bitcoinVersion} is installed" echo "# OK Bitcoin Core ${bitcoinVersion} is installed"
if [ "${state}" == "ready" ]; then if [ "${state}" == "ready" ]; then
echo
echo "# Starting ..."
sudo systemctl start bitcoind sudo systemctl start bitcoind
sleep 10
echo
sudo systemctl start lnd sudo systemctl start lnd
echo "# Starting LND ..."
sleep 10
echo echo
echo "# Restarted LND" echo "# Press ENTER to proceed to unlock the LND wallet ..."
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 read key
sudo /home/admin/config.scripts/lnd.unlock.sh
fi fi
exit 0 exit 0