From 2bd79c80876f55b7920b05870d9514fe234dc3f9 Mon Sep 17 00:00:00 2001 From: openoms Date: Mon, 3 Jun 2019 07:47:57 +0100 Subject: [PATCH] ask for commit in script --- lnd.from.source.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lnd.from.source.sh diff --git a/lnd.from.source.sh b/lnd.from.source.sh new file mode 100644 index 0000000..d77f47a --- /dev/null +++ b/lnd.from.source.sh @@ -0,0 +1,51 @@ +# LND Update Script + +# Download and run this script on the RaspiBlitz: +# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/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: https://github.com/lightningnetwork/lnd/commits/master" +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 + +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