-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_grospc.sh
133 lines (120 loc) · 10.9 KB
/
update_grospc.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
#get current version
echo nethermind
remote_version=$(curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq .tag_name)
remote_version="${remote_version//'"'}"
echo $remote_version
local_version=$(cat /data1/current_version)
echo $local_version
if [ "$remote_version" = "$local_version" ]; then
echo "nethermind a jour"
else
echo "updating"
cd /data1/
curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq -r ".assets[] | select(.name | contains(\"netherm
ind-linux-amd64\")) | .browser_download_url" | wget -qi -
sudo service nethermind stop
unzip -o -qq nethermind-linux-amd64* -d nethermind
sudo service nethermind start
rm -f *.zip
echo $remote_version > /data1/current_version
fi
echo besu
remote_version=$(curl -s https://api.github.com/repos/hyperledger/besu/releases/latest | jq .tag_name)
remote_version="${remote_version//'"'}"
echo $remote_version
local_version=$(cat /data3/current_version)
echo $local_version
if [ "$remote_version" = "$local_version" ]; then
echo "besu a jour"
else
echo "updating"
cd /data3/
input=$(curl -s https://api.github.com/repos/hyperledger/besu/releases/latest | jq -r '.body')
while IFS= read -r line
do
if grep -q "https" <<< "$line" && grep -q "zip" <<< "$line"; then
echo $line | wget -qi -
fi
done < <(printf '%s\n' "$input")
sudo service besu stop
#unzipping
unzip -o -qq "besu*" -d /data3/temp/
rm -rf /data3/besu/*
mv /data3/temp/besu*/* /data3/besu/
rm -rf /data3/temp/*
sudo service besu start
rm -f /data3/besu*.zip
echo $remote_version > /data3/current_version
fi
echo erigon
echo "updating"
cd /data4/erigon
git pull --quiet
make erigon
sudo service erigon restart
echo teku
remote_version=$(curl -s https://api.github.com/repos/ConsenSys/teku/releases/latest | jq .tag_name)
remote_version="${remote_version//'"'}"
echo $remote_version
local_version=$(cat /data3/current_version_teku)
echo $local_version
if [ "$remote_version" = "$local_version" ]; then
echo "teku a jour"
else
echo "updating"
cd /data3/
input=$(curl -s https://api.github.com/repos/ConsenSys/teku/releases/latest | jq -r '.body')
while IFS= read -r line
do
if grep -q "https" <<< "$line" && grep -q "zip" <<< "$line"; then
grep -oP '(?<=]\().*?(?=\))' <<< "$line" | wget -qi -
fi
done < <(printf '%s\n' "$input")
sudo service teku stop
#unzipping
unzip -o -qq "teku*" -d /data3/temp/
rm -rf /data3/teku/*
mv /data3/temp/teku*/* /data3/teku/
rm -rf /data3/temp/*
sudo service teku start
rm -f /data3/teku*.zip
echo $remote_version > /data3/current_version_teku
fi
echo nimbus
remote_version=$(curl -s https://api.github.com/repos/status-im/nimbus-eth2/releases/latest | jq .tag_name)
remote_version="${remote_version//'"'}"
echo $remote_version
local_version=$(cat /data2/current_version_nimbus)
echo $local_version
if [ "$remote_version" = "$local_version" ]; then
echo "nimbus a jour"
else
echo "updating"
cd /data2/nimbus
sudo service nimbus stop
curl -s https://api.github.com/repos/status-im/nimbus-eth2/releases/latest | jq -r ".assets[] | select(.name | contains(\"Linux_amd\")) | .browser_download_url" | wget -qi -
tar xvzf nimbus-eth2_Linux_amd64*.tar.gz --strip-components=1 -C /data2/nimbus/nimbus-bin
sudo service nimbus start
rm -rf /data2/nimbus/nimbus-eth2_Linux_amd64_*
echo $remote_version > /data2/current_version_nimbus
fi
echo prysm
remote_version=$(curl -s https://api.github.com/repos/prysmaticlabs/prysm/releases/latest | jq .tag_name)
remote_version="${remote_version//'"'}"
echo $remote_version
local_version=$(cat /data4/current_version_prysm)
echo $local_version
if [ "$remote_version" = "$local_version" ]; then
echo "prysm a jour"
else
echo "updating"
cd /data4/prysm
curl -s https://api.github.com/repos/prysmaticlabs/prysm/releases/latest | jq -r ".assets[] | select(.name | contains(\"beacon\")) | select(.name | endswith(\"linux-amd64\")) | select(.name | contains(\"modern\") | not) | .browser_download_url" | wget -qi -
sudo service prysm stop
mv beacon-chain-* beacon-chain
chmod +x beacon-chain
sudo service prysm start
echo $remote_version > /data4/current_version_prysm
fi
echo done