diff --git a/electrs/4_electrum_install.sh b/electrs/4_electrum_install.sh index c231a5a..5635790 100644 --- a/electrs/4_electrum_install.sh +++ b/electrs/4_electrum_install.sh @@ -1,5 +1,5 @@ # Download and run this script to the Linux desktop: -# $ wget https://gist.github.com/openoms/8d365f330f5e1288933e0f4874b56dbd/raw/2cf47bf5cc629e861540f4dd5fa525fd157fc341/4_electrum_install && bash 4_electrum_install.sh +# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/electrs/4_electrum_install && bash 4_electrum_install.sh # https://electrum.org/#download # Install dependencies: diff --git a/lnd.update.sh b/lnd.update.sh new file mode 100644 index 0000000..0142103 --- /dev/null +++ b/lnd.update.sh @@ -0,0 +1,99 @@ +# LND Update Script + +# Download and run this script to the Linux desktop: +# $ wget https://gist.github.com/openoms/8d365f330f5e1288933e0f4874b56dbd/raw/2cf47bf5cc629e861540f4dd5fa525fd157fc341/4_electrum_install && bash 4_electrum_install.sh + + +## 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.6.1-beta-rc2" + +if [ ${isARM} -eq 1 ] ; then + lndOSversion="armv7" + lndSHA256="acaed77436ea210164553ac9e11b87c92ed918f10b6a5e54f96c01ca0b93fe24" +fi +if [ ${isAARCH64} -eq 1 ] ; then + lndOSversion="arm64" + lndSHA256="ce3e3ce3df6d5d98a78c776a06fa9a2cc5826f4ad6579bc36de4b6d634495efa" +fi +if [ ${isX86_64} -eq 1 ] ; then + lndOSversion="amd64" + lndSHA256="860a5d0a56c1ec9eef33a5f29c20013221b95298468825a1b7793d13320cba70" +fi + +echo "Check if Linux base ..." +isARM=$(uname -m | grep -c 'arm') +isAARCH64=$(uname -m | grep -c 'aarch64') +isX86_64=$(uname -m | grep -c 'x86_64') +if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] ; then + echo "!!! FAIL !!!" + echo "Can only build on ARM, aarch64 or x86_64 not on:" + uname -m + exit 1 +else + echo "OK running on $(uname -m) architecture." +fi + +echo "" +echo "*** LND v${bitcoinVersion} for ${bitcoinOSversion} ***" + +# olaoluwa +PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" +PGPcheck="BD599672C804AF2770869A048B80CD2BB8BD8132" +# bitconner +#PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc" +#PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7" + +# get LND resources +cd /home/admin/download +binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" +sudo -u admin wget https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} +sudo -u admin wget https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt +sudo -u admin wget https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig +sudo -u admin wget -O /home/admin/download/pgp_keys.asc ${PGPpkeys} + +# check binary is was not manipulated (checksum test) +binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) +if [ "${binaryChecksum}" != "${lndSHA256}" ]; then + echo "!!! FAIL !!! Downloaded LND BINARY not matching SHA256 checksum: ${lndSHA256}" + exit 1 +fi + +# check gpg finger print +gpg ./pgp_keys.asc +fingerprint=$(sudo gpg /home/admin/download/pgp_keys.asc 2>/dev/null | grep "${PGPcheck}" -c) +if [ ${fingerprint} -lt 1 ]; then + echo "" + echo "!!! BUILD WARNING --> LND PGP author not as expected" + 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 +sleep 3 +verifyResult=$(gpg --verify manifest-v${lndVersion}.txt.sig 2>&1) +goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) +echo "goodSignature(${goodSignature})" +correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${olaoluwaPGP}" -c) +echo "correctKey(${correctKey})" +if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then + echo "" + echo "!!! BUILD FAILED --> LND PGP Verify not OK / signatute(${goodSignature}) verify(${correctKey})" + exit 1 +fi + +sudo systemctl stop lnd + +# install +sudo -u admin tar -xzf ${binaryName} +sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-${lndOSversion}-v${lndVersion}/* +sleep 3 +installed=$(sudo -u admin lnd --version) +if [ ${#installed} -eq 0 ]; then + echo "" + echo "!!! BUILD FAILED --> Was not able to install LND" + exit 1 +fi + +sudo systemctl restart lnd \ No newline at end of file