diff --git a/lnd.updates/README.md b/lnd.updates/README.md deleted file mode 100644 index 30e122c..0000000 --- a/lnd.updates/README.md +++ /dev/null @@ -1,39 +0,0 @@ -## Automated LND update scripts for the RaspiBlitz and compatible systems - -Moved to the repo: [https://github.com/openoms/lightning-node-management](https://github.com/openoms/lightning-node-management/blob/master/lnd.updates/README.md) - -#### [Build LND from source](lnd.from.source.sh) -* Download and run this script on the RaspiBlitz: - `$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.from.source.sh && sudo bash lnd.from.source.sh` - -* Will ask for the commit to checkout from. -Choose a commit ID from this list: https://github.com/lightningnetwork/lnd/commits/master - - -### [Check for the latest official release and notes](https://github.com/lightningnetwork/lnd/releases/) - -#### [Update LND to v0.7.0-beta](lnd.update.v0.7.0-beta.sh) - -* Download and run this script on the RaspiBlitz: -`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta.sh && sudo bash lnd.update.v0.7.0-beta.sh` - -#### [Update LND to v0.7.0-beta-rc3](lnd.update.v0.7.0-beta-rc3.sh) - -* Download and run this script on the RaspiBlitz: -`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc3.sh && sudo bash lnd.update.v0.7.0-beta-rc3.sh` - - -#### [Update LND to v0.7.0-beta-rc2](lnd.update.v0.7.0-beta-rc2.sh) -* Download and run the script to update: -`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc2.sh && sudo bash lnd.update.v0.7.0-beta-rc2.sh` - -#### [Update LND to v0.7.0-beta-rc1](lnd.update.v0.7.0-beta-rc1.sh) -* Download and run the script to update: -`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc1.sh && sudo bash lnd.update.v0.7.0-beta-rc1.sh` - -#### [Update LND to v0.6.1-beta](lnd.update.v0.6.1-beta.sh) -* Download and run the script to update: -`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.6.1-beta.sh && sudo bash lnd.update.v0.6.1-beta.sh` - - - diff --git a/lnd.updates/go.install.sh b/lnd.updates/go.install.sh deleted file mode 100644 index a362e11..0000000 --- a/lnd.updates/go.install.sh +++ /dev/null @@ -1,53 +0,0 @@ -echo "" -echo "*** CHECK BASE IMAGE ***" - -# armv7=32Bit , armv8=64Bit -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# "*** Installing Go ***" -# Go is needed for ZAP connect later -# see https://golang.org/dl/ -goVersion="1.12.7" -if [ ${isARM} -eq 1 ] ; then - goOSversion="armv6l" -fi -if [ ${isAARCH64} -eq 1 ] ; then - goOSversion="arm64" -fi -if [ ${isX86_64} -eq 1 ] ; then - goOSversion="amd64" -fi -if [ ${isX86_32} -eq 1 ] ; then - goOSversion="386" -fi - -echo "*** Installing Go v${goVersion} for ${goOSversion} ***" - -# wget https://storage.googleapis.com/golang/go${goVersion}.linux-${goOSversion}.tar.gz -wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz -if [ ! -f "./go${goVersion}.linux-${goOSversion}.tar.gz" ] -then - echo "!!! FAIL !!! Download not success." - exit 1 -fi -sudo tar -C /usr/local -xzf go${goVersion}.linux-${goOSversion}.tar.gz -sudo rm *.gz -sudo mkdir /usr/local/gocode -sudo chmod 777 /usr/local/gocode -export GOROOT=/usr/local/go -export PATH=$PATH:$GOROOT/bin -export GOPATH=/usr/local/gocode -export PATH=$PATH:$GOPATH/bin -echo "" \ No newline at end of file diff --git a/lnd.updates/lnd.from.source.patched.corr.sh b/lnd.updates/lnd.from.source.patched.corr.sh deleted file mode 100644 index b99c0bc..0000000 --- a/lnd.updates/lnd.from.source.patched.corr.sh +++ /dev/null @@ -1,50 +0,0 @@ -# LND Update Script to build patch for https://github.com/rootzoll/raspiblitz/issues/595 - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.from.source.patched.corr.sh && sudo bash lnd.from.source.patched.corr.sh - -sudo systemctl stop lnd - -#### Build from Source -# To quickly catch up get latest patches if needed -repo="github.com/openoms/lnd" -commit="580509191007617afa6da4b6b0151b4b5313eb72" -# https://github.com/openoms/lnd/commit/1a59596df3e8ae9e95a858cda33c329d4736d1bd - -# BUILDING LND FROM SOURCE -echo "*** Build LND from Source ***" -echo "repo=${repo}" -echo "up to the commit=${commit}" - -export GOROOT=/usr/local/go -export PATH=$PATH:$GOROOT/bin -export GOPATH=/usr/local/gocode -export PATH=$PATH:$GOPATH/bin -sudo rm -r /usr/local/gocode/src/github.com/openoms -go get -d $repo -# make sure to always have the same code (commit) to build -# TODO: To update lnd -> change to latest commit -cd $GOPATH/src/${repo} -sudo git checkout ${commit} -make && make install -sudo chmod 555 /usr/local/gocode/bin/lncli -sudo chmod 555 /usr/local/gocode/bin/lnd -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/admin/.bashrc" -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/pi/.bashrc" -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/bitcoin/.bashrc" - -lndVersionCheck=$(lncli --version) -if [ ${#lndVersionCheck} -eq 0 ]; then - echo "FAIL - Something went wrong with building LND from source." - echo "Sometimes it may just be a connection issue. Reset to fresh Rasbian and try again?" - exit 1 -fi -echo "" -echo "** Link to /usr/local/bin ***" -sudo ln -s /usr/local/gocode/bin/lncli /usr/local/bin/lncli -sudo ln -s /usr/local/gocode/bin/lnd /usr/local/bin/lnd - -sudo systemctl restart lnd - -echo "" -echo "LND VERSION INSTALLED: ${lndVersionCheck} up to commit ${commit} from ${repo}" \ No newline at end of file diff --git a/lnd.updates/lnd.from.source.sh b/lnd.updates/lnd.from.source.sh deleted file mode 100644 index 6b89240..0000000 --- a/lnd.updates/lnd.from.source.sh +++ /dev/null @@ -1,57 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.from.source.sh && sudo bash lnd.from.source.sh - -#### Build from Source -# To quickly catch up get latest patches if needed -repo="github.com/lightningnetwork/lnd" -echo "Paste the latest or desired commit ID to checkout from" -echo "See the list at: https://github.com/lightningnetwork/lnd/commits/master" -echo "Example:" -echo "4068e78af690f9b4a598de1f3f0b21b5560dd146" -echo "(if left empty will use the latest state of the master branch)" -echo "and press ENTER" -read commit -# commit="580509191007617afa6da4b6b0151b4b5313eb72" - -# BUILDING LND FROM SOURCE -echo "*** Build LND from Source ***" -echo "repo=${repo}" -echo "up to the commit=${commit}" - -sudo systemctl stop lnd - -export GOROOT=/usr/local/go -export PATH=$PATH:$GOROOT/bin -export GOPATH=/usr/local/gocode -export PATH=$PATH:$GOPATH/bin -echo "Deleting old source..." -sudo rm -r /usr/local/gocode/src/github.com/lightningnetwork/lnd -go get -d $repo - -echo "Building LND..." -cd $GOPATH/src/${repo} -sudo git checkout ${commit} -make && make install -sudo chmod 555 /usr/local/gocode/bin/lncli -sudo chmod 555 /usr/local/gocode/bin/lnd -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/admin/.bashrc" -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/pi/.bashrc" -sudo bash -c "echo 'export PATH=$PATH:/usr/local/gocode/bin/' >> /home/bitcoin/.bashrc" - -lndVersionCheck=$(lncli --version) -if [ ${#lndVersionCheck} -eq 0 ]; then - echo "FAIL - Something went wrong with building LND from source." - echo "Sometimes it may just be a connection issue. Reset to fresh Rasbian and try again?" - exit 1 -fi -echo "" -echo "** Link to /usr/local/bin ***" -sudo ln -s /usr/local/gocode/bin/lncli /usr/local/bin/lncli -sudo ln -s /usr/local/gocode/bin/lnd /usr/local/bin/lnd - -sudo systemctl restart lnd - -echo "" -echo "LND VERSION INSTALLED: ${lndVersionCheck} up to commit ${commit} from ${repo}" \ No newline at end of file diff --git a/lnd.updates/lnd.update.v0.6.1-beta.sh b/lnd.updates/lnd.update.v0.6.1-beta.sh deleted file mode 100644 index 35db294..0000000 --- a/lnd.updates/lnd.update.v0.6.1-beta.sh +++ /dev/null @@ -1,107 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.6.1-beta.sh && sudo bash lnd.update.v0.6.1-beta.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" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# update the SHA256 checksum upon version change -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256="5541959c7fde98d76d88cc8070ca626c681ba38c44afcb85bf417a9a677e23c2" -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256="d5f7280c324ebc1d322435a0eac4c42dca73ebc6a613878d9e0d33a68276da5c" -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256="c55367edb82955dc942baf9f48f79fadde1eee0e86c1d59d2fe1993140ec1b3f" -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256="00a7cd0ca657bb242b0f3acb5f4e26a13fd789946fab73c252118e3f89c1cf57" -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" - -# 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 "${downloadDir}" -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/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 "${downloadDir}/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 - -echo "" -echo "Installed ${installed}" \ No newline at end of file diff --git a/lnd.updates/lnd.update.v0.7.0-beta-rc1.sh b/lnd.updates/lnd.update.v0.7.0-beta-rc1.sh deleted file mode 100644 index 9362e07..0000000 --- a/lnd.updates/lnd.update.v0.7.0-beta-rc1.sh +++ /dev/null @@ -1,107 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc1.sh && sudo bash lnd.update.v0.7.0-beta-rc1.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.7.0-beta-rc1" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# update the SHA256 checksum upon version change -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256="24f4860d44d726a0e2fb14c5a368d521637b9ecc009b552a8ce987b0b28f3544" -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256="5f4666a9c12e578c41faea4868cd5ea447dfa0e80ce7a282eced36e1205df968" -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256="6cb52c42c6b837b8dda35124cb74c591b3f9167f92e73d0e3ea46b359cb5bdf4" -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256="e19ee77f5c680b3dd9cdd9286273ae076f653e31a930ec2e268ac38a2102c11a" -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" - -# 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 "${downloadDir}" -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/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 "${downloadDir}/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 - -echo "" -echo "Installed ${installed}" \ No newline at end of file diff --git a/lnd.updates/lnd.update.v0.7.0-beta-rc2.sh b/lnd.updates/lnd.update.v0.7.0-beta-rc2.sh deleted file mode 100644 index dfe0788..0000000 --- a/lnd.updates/lnd.update.v0.7.0-beta-rc2.sh +++ /dev/null @@ -1,107 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc2.sh && sudo bash lnd.update.v0.7.0-beta-rc2.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.7.0-beta-rc2" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# update the SHA256 checksum upon version change -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256="2b8452475580bb069957183b4bc1aa37b54d64648f1db6361188ac08f79b8fb5" -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256="ebaa2f21e2906b9f3f2cfdf0a41f06f3dd4ce0e89806e6e5327eacc45165b6c9" -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256="0db64dccb102412f3e1d076ca8c75f207359df8f56e82ea128749a6207890c25" -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256="a57b6a12c7af5e3027392c0fa0725d9ecc1f70f8642be24eb7bc9d88a10571e2" -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" - -# 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 "${downloadDir}" -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/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 "${downloadDir}/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 - -echo "" -echo "Installed ${installed}" diff --git a/lnd.updates/lnd.update.v0.7.0-beta-rc3.sh b/lnd.updates/lnd.update.v0.7.0-beta-rc3.sh deleted file mode 100644 index 8fc2a9e..0000000 --- a/lnd.updates/lnd.update.v0.7.0-beta-rc3.sh +++ /dev/null @@ -1,107 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta-rc3.sh && sudo bash lnd.update.v0.7.0-beta-rc3.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.7.0-beta-rc3" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# update the SHA256 checksum upon version change -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256="92d2cf564714057ebf63f952454e4255e3e16e590178d096f75efc40931ace9a" -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256="a0f40ec55ac9a9898657ede6084b32ae150d2d0483975eb1a6aab3c5fa691f2d" -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256="d90bf078edc57f12cfebfae96aaa6d686a8036a3cb1b8684855f773edd9f2ec7" -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256="2723ce9dff50a2b063ba01b2b2cf4159db5aed5ade76a20978dfac361152fa06" -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" - -# 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 "${downloadDir}" -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/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 "${downloadDir}/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 - -echo "" -echo "Installed ${installed}" diff --git a/lnd.updates/lnd.update.v0.7.0-beta.sh b/lnd.updates/lnd.update.v0.7.0-beta.sh deleted file mode 100644 index 3c72279..0000000 --- a/lnd.updates/lnd.update.v0.7.0-beta.sh +++ /dev/null @@ -1,108 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.0-beta.sh && sudo bash lnd.update.v0.7.0-beta.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.7.0-beta" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -# update the SHA256 checksum upon version change -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256="ac51d96ee9b57bfcab0b05dbcfcd9ce3bd42a216354c0972e97c1a1c86c2479a" -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256="c995fa67d6b23e547723801de49817dda34188fba78d0fe8ae506774e54c0afd" -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256="c818c3a983167312f3bf2c84cb285212c5052131319caaef287a97541d2ff479" -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256="47be6c3391fadbc5a169fa1dd6dd13031d759b3d42c71a2d556751746b705c48" -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" - -# 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 "${downloadDir}" -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/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 "${downloadDir}/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 - -echo "" -echo "Installed ${installed}" diff --git a/lnd.updates/lnd.update.v0.7.1-beta.sh b/lnd.updates/lnd.update.v0.7.1-beta.sh deleted file mode 100644 index 54a7498..0000000 --- a/lnd.updates/lnd.update.v0.7.1-beta.sh +++ /dev/null @@ -1,112 +0,0 @@ -# LND Update Script - -# Download and run this script on the RaspiBlitz: -# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/lnd.updates/lnd.update.v0.7.1-beta.sh && sudo bash lnd.update.v0.7.1-beta.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.7.1-beta" # the version you would like to be updated -downloadDir="/home/admin/download" # edit your download directory - -# check who signed the release in https://github.com/lightningnetwork/lnd/releases -# olaoluwa -PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" -PGPcheck="BD599672C804AF2770869A048B80CD2BB8BD8132" - -# bitconner -# PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc" -# PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7" - -echo "Detect CPU architecture ..." -isARM=$(uname -m | grep -c 'arm') -isAARCH64=$(uname -m | grep -c 'aarch64') -isX86_64=$(uname -m | grep -c 'x86_64') -isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then - echo "!!! FAIL !!!" - echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" - uname -m - exit 1 -else - echo "OK running on $(uname -m) architecture." -fi - -cd "${downloadDir}" - -# get lndOSversion and lndSHA256 for the corresponding platform -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt -if [ ${isARM} -eq 1 ] ; then - lndOSversion="armv7" - lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) -fi -if [ ${isAARCH64} -eq 1 ] ; then - lndOSversion="arm64" - lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) -fi -if [ ${isX86_64} -eq 1 ] ; then - lndOSversion="amd64" - lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) -fi -if [ ${isX86_32} -eq 1 ] ; then - lndOSversion="386" - lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) -fi -echo "" -echo "*** LND v${lndVersion} for ${lndOSversion} ***" -echo "SHA256 hash: $lndSHA256" -echo "" - -# get LND binary -binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} - -# check binary was not manipulated (checksum test) -sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig -sudo -u admin wget -N -O "${downloadDir}/pgp_keys.asc" ${PGPpkeys} -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 "${downloadDir}/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 "${GPGcheck}" -c) -echo "correctKey(${correctKey})" -if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then - echo "" - echo "!!! BUILD FAILED --> LND PGP Verify not OK / signature(${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 - -echo "" -echo "Installed ${installed}" \ No newline at end of file diff --git a/raspiblitz.updates/README.md b/raspiblitz.updates/README.md new file mode 100644 index 0000000..4d4b8ba --- /dev/null +++ b/raspiblitz.updates/README.md @@ -0,0 +1,11 @@ +## Automated update scripts for the RaspiBlitz and compatible systems + +## Bitcoin Core Updates +### [v0.19.1](/raspiblitz.updates/bitcoincore.update.v0.19.1.sh) +* Not compatible with LND under v0.8.1, use with RaspiBlitz v1.4 or update LND first. +* To download and run with a single line paste to the RaspiBlitz terminal: +`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/raspiblitz.updates/bitcoincore.update.v0.19.1.sh && bash bitcoincore.update.v0.19.1.sh` + +## LND updates + +Find in: [https://github.com/openoms/lightning-node-management](https://github.com/openoms/lightning-node-management/blob/master/lnd.updates/README.md) \ No newline at end of file diff --git a/lnd.updates/bitcoin.install.sh b/raspiblitz.updates/bitcoincore.update.v0.19.1.sh similarity index 63% rename from lnd.updates/bitcoin.install.sh rename to raspiblitz.updates/bitcoincore.update.v0.19.1.sh index fe4c426..babde9e 100644 --- a/lnd.updates/bitcoin.install.sh +++ b/raspiblitz.updates/bitcoincore.update.v0.19.1.sh @@ -1,9 +1,15 @@ +#!/bin/bash -echo "" -echo "*** CHECK BASE IMAGE ***" +# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md#installation -# armv7=32Bit , armv8=64Bit -echo "Detect CPU architecture ..." +# set version (change if update is available) +# https://bitcoincore.org/en/download/ +bitcoinVersion="0.19.1" + +# needed to check code signing +laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964" + +echo "Detecting CPU architecture ..." isARM=$(uname -m | grep -c 'arm') isAARCH64=$(uname -m | grep -c 'aarch64') isX86_64=$(uname -m | grep -c 'x86_64') @@ -17,67 +23,28 @@ else echo "OK running on $(uname -m) architecture." fi -# "*** BITCOIN ***" -# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md#installation - -# set version (change if update is available) -# https://bitcoincore.org/en/download/ -# bitcoinVersion="0.18.0" # commented out checksums for this version until lnd version >0.5.1 -bitcoinVersion="0.17.1" - -# set OS version and checksum -# needed to make sure download is not changed -# calculate with sha256sum and also check with SHA256SUMS.asc -# https://bitcoincore.org/bin/bitcoin-core-0.18.0/SHA256SUMS.asc -if [ ${isARM} -eq 1 ] ; then - bitcoinOSversion="arm-linux-gnueabihf" - # bitcoinSHA256="3d7eb57290b2f14c495a24ecbab8100b35861f0c81bc10d86e5c0a8ec8284b27" - bitcoinSHA256="aab3c1fb92e47734fadded1d3f9ccf0ac5a59e3cdc28c43a52fcab9f0cb395bc" -fi -if [ ${isAARCH64} -eq 1 ] ; then - bitcoinOSversion="aarch64-linux-gnu" - # bitcoinSHA256="bfc3b8fddbb7ab9b532c9866859fc507ec959bdb82954966f54c8ebf8c7bb53b" - bitcoinSHA256="5659c436ca92eed8ef42d5b2d162ff6283feba220748f9a373a5a53968975e34" -fi -if [ ${isX86_64} -eq 1 ] ; then - bitcoinOSversion="x86_64-linux-gnu" - # bitcoinSHA256="5146ac5310133fbb01439666131588006543ab5364435b748ddfc95a8cb8d63f" - bitcoinSHA256="53ffca45809127c9ba33ce0080558634101ec49de5224b2998c489b6d0fc2b17" -fi -if [ ${isX86_32} -eq 1 ] ; then - bitcoinOSversion="i686-pc-linux-gnu" - # bitcoinSHA256="36ce9ffb375f6ee280df5a86e61038e3c475ab9dee34f6f89ea82b65a264183b" - bitcoinSHA256="b1e1dcf8265521fef9021a9d49d8661833e3f844ca9a410a9dd12a617553dda1" +echo "Checking if LND is up-to-date..." +lndVersion=$(lnd --version | awk '{print $3}' | cut -d'-' -f1 | sed 's/\.//g') +if [ ${lndVersion} -ge 081 ]; then + echo "LND is up-to-date." +else + echo "" + echo "LND is not up-to-date." + echo "LND < v0.8.1 is incompatible with Bitcoin Core v0.19.0.1 and above" + echo "Please update LND via the update script found here:" + echo "https://github.com/openoms/lightning-node-management/tree/master/lnd.updates" + exit 1 fi echo "" -echo "*** BITCOIN v${bitcoinVersion} for ${bitcoinOSversion} ***" - -# needed to check code signing -laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964" +echo "*** PREPARING BITCOIN ***" # prepare directories -sudo rm -r /home/admin/download -sudo -u admin mkdir /home/admin/download +sudo rm -rf /home/admin/download 2>/dev/null +sudo -u admin mkdir /home/admin/download 2>/dev/null cd /home/admin/download -# download resources -binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz" -sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName} -if [ ! -f "./${binaryName}" ] -then - echo "!!! FAIL !!! Download BITCOIN BINARY not success." - exit 1 -fi - -# check binary is was not manipulated (checksum test) -binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) -if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then - echo "!!! FAIL !!! Downloaded BITCOIN BINARY not matching SHA256 checksum: ${bitcoinSHA256}" - exit 1 -fi - -# check gpg finger print +# download, check and import signer key sudo -u admin wget https://bitcoin.org/laanwj-releases.asc if [ ! -f "./laanwj-releases.asc" ] then @@ -94,6 +61,8 @@ if [ ${fingerprint} -lt 1 ]; then read key fi gpg --import ./laanwj-releases.asc + +# download signed binary sha256 hash sum file and check sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1) goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) @@ -104,15 +73,60 @@ if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then echo "" echo "!!! BUILD FAILED --> LND PGP Verify not OK / signatute(${goodSignature}) verify(${correctKey})" exit 1 +else + echo "" + echo "****************************************" + echo "OK --> BITCOIN MANIFEST IS CORRECT" + echo "****************************************" + echo "" fi -# correct versions for install if needed -# just if an small update shows a different formatted version number -if [ "${bitcoinVersion}" = "0.17.0.1" ]; then - bitcoinVersion="0.17.0" +# get the sha256 value for the corresponding platform from signed hash sum file +if [ ${isARM} -eq 1 ] ; then + bitcoinOSversion="arm-linux-gnueabihf" +fi +if [ ${isAARCH64} -eq 1 ] ; then + bitcoinOSversion="aarch64-linux-gnu" +fi +if [ ${isX86_64} -eq 1 ] ; then + bitcoinOSversion="x86_64-linux-gnu" +fi +if [ ${isX86_32} -eq 1 ] ; then + bitcoinOSversion="i686-pc-linux-gnu" +fi +bitcoinSHA256=$(grep -i "$bitcoinOSversion" SHA256SUMS.asc | cut -d " " -f1) + +echo "" +echo "*** BITCOIN v${bitcoinVersion} for ${bitcoinOSversion} ***" + +# download resources +binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz" +sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName} +if [ ! -f "./${binaryName}" ] +then + echo "!!! FAIL !!! Download BITCOIN BINARY not success." + exit 1 fi -# install +# check binary checksum test +binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) +if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then + echo "!!! FAIL !!! Downloaded BITCOIN BINARY not matching SHA256 checksum: ${bitcoinSHA256}" + exit 1 +else + echo "" + echo "****************************************" + echo "OK --> VERIFIED BITCOIN CHECKSUM CORRECT" + echo "****************************************" + echo "" +fi + +echo "Stopping bitcoind and lnd" +sudo systemctl stop lnd +sudo systemctl stop bitcoind +echo "" + +echo "Installing Bitcoin Core v${bitcoinVersion}" sudo -u admin tar -xvf ${binaryName} sudo install -m 0755 -o root -g root -t /usr/local/bin/ bitcoin-${bitcoinVersion}/bin/* sleep 3 @@ -121,4 +135,21 @@ if [ ${installed} -lt 1 ]; then echo "" echo "!!! BUILD FAILED --> Was not able to install bitcoind version(${bitcoinVersion})" exit 1 -fi \ No newline at end of file +fi + +sudo systemctl start bitcoind +sleep 2 + +echo "" +echo "Installed $(sudo -u admin bitcoind --version | grep version)" +echo "" + +sudo systemctl start lnd +sleep 10 + +echo "Unlock lnd with the Password C" +lncli unlock +echo "" + +echo "A restart is recommended to bring all services back online. Use: '$ sudo reboot -f'" +echo "" \ No newline at end of file