Skip to content

Instantly share code, notes, and snippets.

@brettbergin
Last active April 16, 2021 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettbergin/3063c0a78dac8dd2cdd42d012aed43a4 to your computer and use it in GitHub Desktop.
Save brettbergin/3063c0a78dac8dd2cdd42d012aed43a4 to your computer and use it in GitHub Desktop.
#/bin/bash
FILENAME=codecov
curl -s https://codecov.io/bash > $FILENAME
CODECOV_VERSION=$(grep 'VERSION=\".*\"' codecov | cut -d'"' -f2);
VALIDATION_FAILURE=0
for i in 1 256 512
do
IS_DIFF=$(diff <(shasum -a $i $FILENAME) <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/$CODECOV_VERSION/SHA${i}SUM))
if [ -z "${IS_DIFF}" ]; then
echo "Sha:" $i "passes validation."
else
VALIDATION_FAILURE=1
fi
done
if [ "${VALIDATION_FAILURE}" == 1 ]; then
echo "Invalid Checksum Detected From Codecov. Quitting."
exit 1
else
echo "Starting Codecov."
chmod +x codecov
./codecov
fi
rm -rf $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment