diff --git a/build_sdcard.sh b/build_sdcard.sh index a515ec466..d31316fcf 100755 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -827,7 +827,7 @@ echo "*** PREPARING BITCOIN ***" # set version (change if update is available) # https://bitcoincore.org/en/download/ -bitcoinVersion="0.21.0" +bitcoinVersion="0.21.1" # needed to check code signing laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964" @@ -839,9 +839,12 @@ cd /home/admin/download # download, check and import signer key sudo -u admin wget https://bitcoin.org/laanwj-releases.asc +if [ ! -f "laanwj-releases.asc" ];then + sudo -u admin wget https://raw.githubusercontent.com/bitcoin-dot-org/Bitcoin.org/master/laanwj-releases.asc +fi if [ ! -f "./laanwj-releases.asc" ] then - echo "!!! FAIL !!! Download laanwj-releases.asc not success." + echo "!!! FAIL !!! Could not download laanwj-releases.asc" exit 1 fi gpg --import --import-options show-only ./laanwj-releases.asc @@ -935,20 +938,16 @@ echo "*** PREPARING LIGHTNING ***" # "*** LND ***" ## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd ## see LND releases: https://github.com/lightningnetwork/lnd/releases -lndVersion="0.12.1-beta" +lndVersion="0.13.1-beta" # olaoluwa -#PGPauthor="roasbeef" -#PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" -#PGPcheck="9769140D255C759B1EB77B46A96387A57CAAE94D" +PGPauthor="roasbeef" +PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" +PGPcheck="E4D85299674B2D31FAA1892E372CBD7633C61696" # bitconner -PGPauthor="bitconner" -PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc" -PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7" -# Joost Jager -#PGPauthor="joostjager" -#PGPpkeys="https://keybase.io/joostjager/pgp_keys.asc" -#PGPcheck="D146D0F68939436268FA9A130E26BB61B76C4D3A" +#PGPauthor="bitconner" +#PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc" +#PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7" # get LND resources cd /home/admin/download @@ -1058,6 +1057,104 @@ fi sudo chown -R admin /home/admin echo "- OK install of LND done" +echo "*** C-lightning ***" +# https://github.com/ElementsProject/lightning/releases +CLVERSION=0.10.1 +# https://github.com/ElementsProject/lightning/tree/master/contrib/keys +PGPsigner="rustyrussel" +PGPpkeys="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt" +PGPcheck="D9200E6CD1ADB8F1" + +# prepare download dir +sudo rm -rf /home/admin/download/cln +sudo -u admin mkdir -p /home/admin/download/cln +cd /home/admin/download/cln || exit 1 + +sudo -u admin wget -O "pgp_keys.asc" ${PGPpkeys} +gpg --import --import-options show-only ./pgp_keys.asc +fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPcheck}" -c) +if [ ${fingerprint} -lt 1 ]; then + echo + echo "!!! WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}" + echo "Should contain PGP: ${PGPcheck}" + echo "PRESS ENTER to TAKE THE RISK if you think all is OK" + read key +fi +gpg --import ./pgp_keys.asc + +sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS +sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS.asc + +verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1) + +goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) +echo "goodSignature(${goodSignature})" +correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPcheck}" -c) +echo "correctKey(${correctKey})" +if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then + echo + echo "!!! BUILD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})" + exit 1 +else + echo + echo "****************************************************************" + echo "OK --> the PGP signature of the C-lighning SHA256SUMS is correct" + echo "****************************************************************" + echo +fi + +sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/clightning-v${CLVERSION}.zip + +hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1) +goodHash=$(echo ${hashCheckResult} | grep 'OK' -c) +echo "goodHash(${goodHash})" +if [ ${goodHash} -lt 1 ]; then + echo + echo "!!! BUILD FAILED --> Hash check not OK" + exit 1 +else + echo + echo "********************************************************************" + echo "OK --> the hash of the downloaded C-lightning source code is correct" + echo "********************************************************************" + echo +fi + +echo "- Install build dependencies" +sudo apt-get install -y \ + autoconf automake build-essential git libtool libgmp-dev \ + libsqlite3-dev python3 python3-mako net-tools zlib1g-dev libsodium-dev \ + gettext unzip + +unzip clightning-v${CLVERSION}.zip +cd clightning-v${CLVERSION} || exit 1 + +echo "- Configuring EXPERIMENTAL_FEATURES enabled" +sudo -u admin ./configure --enable-experimental-features + +currentCLversion=$(git describe --tags 2>/dev/null) +echo "- Building from source C-lightning $currentCLversion" +sudo -u admin make + +echo "- Install to /usr/local/bin/" +sudo make install || exit 1 + +installed=$(sudo -u admin lightning-cli --version) +if [ ${#installed} -eq 0 ]; then + echo + echo "!!! BUILD FAILED --> Was not able to install C-lightning" + exit 1 +fi + +correctVersion=$(echo "${installed}" | grep -c "${CLVERSION}") +if [ ${correctVersion} -eq 0 ]; then + echo + echo "!!! BUILD FAILED --> installed C-lightning is not version ${CLVERSION}" + sudo -u admin lightning-cli --version + exit 1 +fi +echo "- OK the installation of C-lightning v${installed} is done" + echo "" echo "*** raspiblitz.info ***" sudo cat /home/admin/raspiblitz.info