Created
October 7, 2021 13:43
-
-
Save Maigre/0c2b198ca49664d35f3f1506f13570c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, os | |
# total arguments | |
n = len(sys.argv) | |
if n < 2: | |
print("ERROR: please specify the release URL") | |
exit(2) | |
# URL | |
url = sys.argv[1] | |
# DETECT | |
clientfile = url.split('/')[-1] | |
if clientfile.startswith('nimbus-eth2_Linux_amd64_'): | |
client = 'nimbus' | |
clientuser = client | |
version = clientfile.split('nimbus-eth2_Linux_amd64_')[1].split('_')[0] | |
clientdir = clientfile.split('.tar')[0] | |
elif clientfile.startswith('teku'): | |
client = 'teku' | |
clientuser = client | |
version = clientfile.split('teku-')[1].split('.tar')[0] | |
clientdir = clientfile.split('.tar')[0] | |
else: | |
print('ERROR: client not recognised..') | |
exit(2) | |
print("Installing:") | |
print(client.upper()+" v"+version+"\n") | |
#DL | |
print(":: downloading "+url) | |
os.system('sudo -u '+clientuser+' wget -c '+url) | |
#MOVE PREVIOUS INSTALL | |
print(":: removing old install") | |
os.system('sudo rm -R '+client+'-last') | |
#EXTRACT RELEASE | |
print(":: unpacking last release") | |
os.system('sudo -u '+clientuser+' tar -xzf '+clientfile) | |
os.system('sudo -u '+clientuser+' mv '+clientdir+' '+client+'-last') | |
print("\nDONE !\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment