forked from openoms/lightning-node-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chanleakcheck_RaspiBlitz.sh
78 lines (70 loc) · 2.17 KB
/
chanleakcheck_RaspiBlitz.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# export go vars (if needed)
if [ ${#GOROOT} -eq 0 ]; then
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
fi
if [ ${#GOPATH} -eq 0 ]; then
export GOPATH=/usr/local/gocode
export PATH=$PATH:$GOPATH/bin
fi
# get 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')
# make sure go is installed
goVersion="1.12.8"
echo "### Check Framework: GO ###"
goInstalled=$(go version 2>/dev/null | grep -c 'go')
if [ ${goInstalled} -eq 0 ];then
goVersion="1.12.8"
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
sudo bash -c "echo 'PATH=\$PATH:/usr/local/gocode/bin/' >> /etc/profile"
goInstalled=$(go version 2>/dev/null | grep -c 'go')
fi
if [ ${goInstalled} -eq 0 ];then
echo "FAIL: Was not able to install GO (needed to run LndConnect)"
sleep 4
exit 1
fi
correctGoVersion=$(go version | grep -c "go${goVersion}")
if [ ${correctGoVersion} -eq 0 ]; then
echo "WARNING: You work with a untested version of GO - should be ${goVersion} .. trying to continue"
go version
sleep 6
echo ""
fi
# downlaod chanleakcheck
git clone https://github.com/lightninglabs/chanleakcheck.git
cd chanleakcheck
go build -mod=vendor -v
#run and see if the node was affected in the result
./chanleakcheck