Skip to content

Commit 9a8c44e

Browse files
committed
Update Lodestar to use binaries, add error checking for failed archive downloads
1 parent b6b687a commit 9a8c44e

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

ethpillar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# 🙌 Ask questions on Discord:
1313
# * https://discord.gg/dEpAVWgFNB
1414

15-
VERSION="1.7.5"
15+
VERSION="1.7.6"
1616
BASE_DIR=$HOME/git/ethpillar
1717

1818
# Load functions

update_consensus.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ function updateClient(){
7474
echo Downloading URL: $BINARIES_URL
7575
cd $HOME
7676
wget -O lighthouse.tar.gz $BINARIES_URL
77+
if [ ! -f lighthouse.tar.gz ]; then
78+
echo "Error: Downloading lighthouse archive failed!"
79+
exit 1
80+
fi
7781
tar -xzvf lighthouse.tar.gz -C $HOME
7882
rm lighthouse.tar.gz
7983
sudo systemctl stop consensus
@@ -84,14 +88,23 @@ function updateClient(){
8488
test -f /etc/systemd/system/validator.service && sudo service validator start
8589
;;
8690
Lodestar)
87-
cd ~/git/lodestar
88-
git checkout stable && git pull
89-
yarn clean:nm && yarn install
90-
yarn run build
91+
RELEASE_URL="https://api.github.com/repos/ChainSafe/lodestar/releases/latest"
92+
LATEST_TAG="$(curl -s $RELEASE_URL | jq -r ".tag_name")"
93+
BINARIES_URL="https://github.com/ChainSafe/lodestar/releases/download/${LATEST_TAG}/lodestar-${LATEST_TAG}-linux-amd64.tar.gz"
94+
echo Downloading URL: $BINARIES_URL
95+
cd $HOME
96+
wget -O lodestar.tar.gz $BINARIES_URL
97+
if [ ! -f lodestar.tar.gz ]; then
98+
echo "Error: Downloading lodestar archive failed!"
99+
exit 1
100+
fi
101+
tar -xzvf lodestar.tar.gz -C $HOME
102+
rm lodestar.tar.gz
91103
sudo systemctl stop consensus
92104
test -f /etc/systemd/system/validator.service && sudo service validator stop
93105
sudo rm -rf /usr/local/bin/lodestar
94-
sudo cp -a $HOME/git/lodestar /usr/local/bin/lodestar
106+
sudo mkdir -p /usr/local/bin/lodestar
107+
sudo mv $HOME/lodestar /usr/local/bin/lodestar
95108
sudo systemctl start consensus
96109
test -f /etc/systemd/system/validator.service && sudo service validator start
97110
;;
@@ -102,6 +115,10 @@ function updateClient(){
102115
echo Downloading URL: $BINARIES_URL
103116
cd $HOME
104117
wget -O teku.tar.gz $BINARIES_URL
118+
if [ ! -f teku.tar.gz ]; then
119+
echo "Error: Downloading teku archive failed!"
120+
exit 1
121+
fi
105122
tar -xzvf teku.tar.gz -C $HOME
106123
mv teku-* teku
107124
rm teku.tar.gz
@@ -118,6 +135,10 @@ function updateClient(){
118135
echo Downloading URL: $BINARIES_URL
119136
cd $HOME
120137
wget -O nimbus.tar.gz $BINARIES_URL
138+
if [ ! -f nimbus.tar.gz ]; then
139+
echo "Error: Downloading nimbus archive failed!"
140+
exit 1
141+
fi
121142
tar -xzvf nimbus.tar.gz -C $HOME
122143
mv nimbus-eth2_Linux_amd64_* nimbus
123144
sudo systemctl stop consensus

0 commit comments

Comments
 (0)