build lnd from source

This commit is contained in:
rootzoll 2018-08-19 19:57:59 +02:00
parent dafe5e3a2b
commit e8ed464bac
5 changed files with 74 additions and 45 deletions

View File

@ -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

View File

@ -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}"

View File

@ -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

View File

@ -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

View File

@ -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