From e8ed464bacd4470d1a0a3d9fad43f399ab99c090 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 19 Aug 2018 19:57:59 +0200 Subject: [PATCH] build lnd from source --- build.sdcard/raspbianStretchDesktop.sh | 112 +++++++++++++++---------- home.admin/00infoBlitz.sh | 2 +- home.admin/50downloadHDD.sh | 1 + home.admin/assets/lnd.service | 2 +- home.admin/assets/lnd.tor.service | 2 +- 5 files changed, 74 insertions(+), 45 deletions(-) diff --git a/build.sdcard/raspbianStretchDesktop.sh b/build.sdcard/raspbianStretchDesktop.sh index bf073f5..7e676e7 100644 --- a/build.sdcard/raspbianStretchDesktop.sh +++ b/build.sdcard/raspbianStretchDesktop.sh @@ -10,7 +10,7 @@ echo "" echo "***************************************" -echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.6 *" +echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.7 *" echo "***************************************" echo "" @@ -230,48 +230,76 @@ sudo mv ./getpublicip.service /etc/systemd/system/getpublicip.service sudo systemctl enable getpublicip sudo systemctl start getpublicip -# get LND resources -cd /home/admin/download -sudo -u admin wget https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/lnd-linux-arm-v${lndVersion}.tar.gz -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 https://keybase.io/roasbeef/pgp_keys.asc - -# test checksum -checksum=$(sha256sum --check manifest-v${lndVersion}.txt --ignore-missing 2>/dev/null | grep '.tar.gz: OK' -c) -if [ ${checksum} -lt 1 ]; then - echo "" - echo "!!! BUILD FAILED --> LND download checksum not OK" - exit 1 -fi -# check gpg finger print -fingerprint=$(gpg ./pgp_keys.asc 2>/dev/null | grep "${olaoluwaPGP}" -c) -if [ ${fingerprint} -lt 1 ]; then - echo "" - echo "!!! BUILD FAILED --> LND download author PGP not OK" - exit 1 -fi -gpg --import ./pgp_keys.asc -verifyResult=$(gpg --verify manifest-v${lndVersion}.txt.sig manifest-v${lndVersion}.txt 2>&1) -goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) -echo "goodSignature(${goodSignature})" -correctKey=$(echo ${verifyResult} | grep "using RSA key ${olaoluwaPGP: -16}" -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 - -# install -sudo -u admin tar -xzf lnd-linux-arm-v${lndVersion}.tar.gz -sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm-v${lndVersion}/* -sleep 3 -installed=$(sudo -u admin lnd --version | grep "${lndVersion}" -c) -if [ ${installed} -lt 1 ]; then - echo "" - echo "!!! BUILD FAILED --> Was not able to install LND version(${lndVersion})" +# WORKAROUND: UNTIL LND 0.4.3 arm binary version is here ... we need to build from source to +# have TOR integration ... so the following is commented out for now: +# +## get LND resources +#cd /home/admin/download +#sudo -u admin wget https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/lnd-linux-arm-v${lndVersion}.tar.gz +#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 https://keybase.io/roasbeef/pgp_keys.asc +## test checksum +#checksum=$(sha256sum --check manifest-v${lndVersion}.txt --ignore-missing 2>/dev/null | grep '.tar.gz: OK' -c) +#if [ ${checksum} -lt 1 ]; then +# echo "" +# echo "!!! BUILD FAILED --> LND download checksum not OK" +# exit 1 +#fi +## check gpg finger print +#fingerprint=$(gpg ./pgp_keys.asc 2>/dev/null | grep "${olaoluwaPGP}" -c) +#if [ ${fingerprint} -lt 1 ]; then +# echo "" +# echo "!!! BUILD FAILED --> LND download author PGP not OK" +# exit 1 +#fi +#gpg --import ./pgp_keys.asc +#verifyResult=$(gpg --verify manifest-v${lndVersion}.txt.sig manifest-v${lndVersion}.txt 2>&1) +#goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) +#echo "goodSignature(${goodSignature})" +#correctKey=$(echo ${verifyResult} | grep "using RSA key ${olaoluwaPGP: -16}" -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 +## install +#sudo -u admin tar -xzf lnd-linux-arm-v${lndVersion}.tar.gz +#sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm-v${lndVersion}/* +#sleep 3 +#installed=$(sudo -u admin lnd --version | grep "${lndVersion}" -c) +#if [ ${installed} -lt 1 ]; then +# echo "" +# echo "!!! BUILD FAILED --> Was not able to install LND version(${lndVersion})" +# exit 1 +#fi +## BUILDING LND FROM SOURCE +echo "*** Installing Go ***" +wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz +sudo tar -C /usr/local -xzf go1.10.linux-armv6l.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 "*** Build LND from Source ***" +go get -d github.com/lightningnetwork/lnd +cd $GOPATH/src/github.com/lightningnetwork/lnd +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) +echo "LND VERSION: ${lndVersionCheck}" +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 diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index baebb2a..3daa2a7 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -195,7 +195,7 @@ ${color_yellow} ${color_gray}${ln_channels_online}/${ln_channels_t ${color_yellow} ${ln_external} ${color_yellow} " \ -"RaspiBlitz v0.6" \ +"RaspiBlitz v0.7" \ "-------------------------------------------" \ "${load##up*, }" "${temp}" \ "${hdd}" "${sync_percentage}" diff --git a/home.admin/50downloadHDD.sh b/home.admin/50downloadHDD.sh index 7bf9554..7761e1e 100755 --- a/home.admin/50downloadHDD.sh +++ b/home.admin/50downloadHDD.sh @@ -93,6 +93,7 @@ while : echo "Progress: ${progress}% (${actualSize} of ${targetSize})" echo "Timeout: ${timeoutInfo}" echo "If needed press key x to stop ${name}" + echo "NOTICE: This can take multiple hours or days !!" echo "Its OK to close terminal now and SSH back in later." echo "****************************************************" screen -S ${name} -X hardcopy .${name}.out diff --git a/home.admin/assets/lnd.service b/home.admin/assets/lnd.service index 857f64d..ca3e285 100644 --- a/home.admin/assets/lnd.service +++ b/home.admin/assets/lnd.service @@ -12,7 +12,7 @@ After=bitcoind.service # get var PUBIP from file EnvironmentFile=/run/publicip -ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP} +ExecStart=/usr/local/gocode/bin/lnd --externalip=${PUBLICIP} PIDFile=/home/bitcoin/.lnd/lnd.pid User=bitcoin Group=bitcoin diff --git a/home.admin/assets/lnd.tor.service b/home.admin/assets/lnd.tor.service index 7593345..345149e 100644 --- a/home.admin/assets/lnd.tor.service +++ b/home.admin/assets/lnd.tor.service @@ -12,7 +12,7 @@ After=bitcoind.service # get var PUBIP from file EnvironmentFile=/run/publicip -ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 +ExecStart=/usr/local/gocode/bin/lnd --tor.active --tor.v2 PIDFile=/home/bitcoin/.lnd/lnd.pid User=bitcoin Group=bitcoin