prysm scripts should not save 404 pages (#9072)

* first .sh attempt, checked curl

* removed echo

* more meaningful msg

* prysm.bat changes

* do not save 404, using -f and grep

* removed extra line

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
ahadda5 2021-07-07 03:34:42 +04:00 committed by GitHub
parent 1d3a9983cc
commit 72886986ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 7 deletions

View File

@ -67,10 +67,15 @@ if [%1]==[beacon-chain] (
echo Beacon chain is up to date.
) else (
echo Downloading beacon chain %prysm_version% to %BEACON_CHAIN_REAL% %reason%
curl -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% -o %BEACON_CHAIN_REAL%
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sha256
for /f "delims=" %%i in ('curl --silent -w "%%{http_code}" -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% -o %BEACON_CHAIN_REAL%') do set http=%%i
if %http%==400 (
echo No prysm beacon chain found for %prysm_version%
exit \b 1
)
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sig -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sig
)
goto startprocess
)
if [%1]==[validator] (
@ -78,10 +83,15 @@ if [%1]==[validator] (
echo Validator is up to date.
) else (
echo Downloading validator %prysm_version% to %VALIDATOR_REAL% %reason%
curl -L https://prysmaticlabs.com/releases/validator-%prysm_version%-%system%-%arch% -o %VALIDATOR_REAL%
for /f "delims=" %%i in ('curl --silent -w "%%{http_code}" -L https://prysmaticlabs.com/releases/validator-%prysm_version%-%system%-%arch% -o %VALIDATOR_REAL%') do set http=%%i
if %http%==400 (
echo No prysm validator found for %prysm_version%
exit \b 1
)
curl --silent -L https://prysmaticlabs.com/releases/validator-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\validator-%prysm_version%-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/validator-%prysm_version%-%system%-%arch%.sig -o %wrapper_dir%\validator-%prysm_version%-%system%-%arch%.sig
)
goto startprocess
)
if [%1]==[client-stats] (
@ -89,10 +99,15 @@ if [%1]==[client-stats] (
echo Client-stats is up to date.
) else (
echo Downloading client-stats %prysm_version% to %CLIENT_STATS_REAL% %reason%
curl -L https://prysmaticlabs.com/releases/client-stats-%prysm_version%-%system%-%arch% -o %CLIENT_STATS_REAL%
for /f "delims=" %%i in ('curl --silent -w "%%{http_code}" -L https://prysmaticlabs.com/releases/client-stats-%prysm_version%-%system%-%arch% -o %CLIENT_STATS_REAL%') do set http=%%i
if %http%==400 (
echo No prysm client stats found for %prysm_version%
exit \b 1
)
curl --silent -L https://prysmaticlabs.com/releases/client-stats-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\client-stats-%prysm_version%-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/client-stats-%prysm_version%-%system%-%arch%.sig -o %wrapper_dir%\client-stats-%prysm_version%-%system%-%arch%.sig
)
goto startprocess
)
if [%1]==[slasher] (
@ -100,6 +115,7 @@ if [%1]==[slasher] (
exit /b 1
)
:startprocess
if [%1]==[beacon-chain] ( set process=%BEACON_CHAIN_REAL%)
if [%1]==[validator] ( set process=%VALIDATOR_REAL%)
if [%1]==[client-stats] ( set process=%CLIENT_STATS_REAL%)

View File

@ -181,7 +181,11 @@ if [[ $1 == beacon-chain ]]; then
if [[ ! -x $BEACON_CHAIN_REAL ]]; then
color "34" "Downloading beacon chain@${prysm_version} to ${BEACON_CHAIN_REAL} (${reason})"
file=beacon-chain-${prysm_version}-${system}-${arch}
curl -L "https://prysmaticlabs.com/releases/${file}" -o "$BEACON_CHAIN_REAL"
res=$(curl -w '%{http_code}\n' -f -L "https://prysmaticlabs.com/releases/${file}" -o "$BEACON_CHAIN_REAL" | ( grep 404 || true ) )
if [[ $res == 404 ]];then
echo "No prysm beacon chain found for ${prysm_version},(${file}) exit"
exit 1
fi
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sha256" -o "${wrapper_dir}/${file}.sha256"
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sig" -o "${wrapper_dir}/${file}.sig"
chmod +x "$BEACON_CHAIN_REAL"
@ -195,7 +199,11 @@ if [[ $1 == validator ]]; then
color "34" "Downloading validator@${prysm_version} to ${VALIDATOR_REAL} (${reason})"
file=validator-${prysm_version}-${system}-${arch}
curl -L "https://prysmaticlabs.com/releases/${file}" -o "$VALIDATOR_REAL"
res=$(curl -w '%{http_code}\n' -f -L "https://prysmaticlabs.com/releases/${file}" -o "$VALIDATOR_REAL" | ( grep 404 || true ) )
if [[ $res == 404 ]];then
echo "No prysm validator found for ${prysm_version}, (${file}) exit"
exit 1
fi
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sha256" -o "${wrapper_dir}/${file}.sha256"
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sig" -o "${wrapper_dir}/${file}.sig"
chmod +x "$VALIDATOR_REAL"
@ -209,7 +217,11 @@ if [[ $1 == client-stats ]]; then
color "34" "Downloading client-stats@${prysm_version} to ${CLIENT_STATS_REAL} (${reason})"
file=client-stats-${prysm_version}-${system}-${arch}
curl -L "https://prysmaticlabs.com/releases/${file}" -o "$CLIENT_STATS_REAL"
res=$(curl -w '%{http_code}\n' -f -L "https://prysmaticlabs.com/releases/${file}" -o "$CLIENT_STATS_REAL" | ( grep 404 || true ) )
if [[ $res == 404 ]];then
echo "No prysm client stats found for ${prysm_version},(${file}) exit"
exit 1
fi
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sha256" -o "${wrapper_dir}/${file}.sha256"
curl --silent -L "https://prysmaticlabs.com/releases/${file}.sig" -o "${wrapper_dir}/${file}.sig"
chmod +x "$CLIENT_STATS_REAL"