Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tarball checksum check - use sha256sum -c #510

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions script_templates/get_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ f="${tarbuildnum}/$tarball"

verify_checksum() {
echo "verify checksum"
checksum=$(wget -qO- "$artifacts_url/$tarbuildnum/sha256sums.txt" | awk '{print $1}')
checksum_file=$(sha256sum "$1" | awk '{print $1}')
wget -qO- "$artifacts_url/$tarbuildnum/sha256sums.txt" | tee sha256sums.txt | sha256sum -c -

if [[ "$checksum_file" == "$checksum" ]]; then
if [ $? ]; then
echo "checksum match"
rm sha256sums.txt
return 0
else
echo "checksum does not match"
sha256sum "$tarball"
echo "previous calculation"
cat sha256sums.txt
rm sha256sums.txt
return 1
fi
}
Expand Down Expand Up @@ -61,29 +65,31 @@ download_tarball() {
fi
}

if [[ -f $d/$tarball ]]; then
echo "$d/$tarball already present"
if verify_checksum "$d/$tarball"; then
pushd "$d"
if [[ -f $tarball ]]; then
echo "$tarball already present"
if verify_checksum; then
true
else
echo "download tarball again"
rm -f $d/$tarball
rm -f $tarball
download_tarball
if verify_checksum "$d/$tarball"; then
if verify_checksum; then
true
else
err "checksum does not match, aborting"
fi
fi
else
echo "$d/$tarball does not exist, download tarball"
echo "$tarball does not exist, download tarball"
download_tarball
if verify_checksum "$d/$tarball"; then
if verify_checksum "$tarball"; then
true
else
err "checksum does not match, aborting"
fi
fi
popd

echo "extract $d/$tarball"
#//TEMP path on AIX are specific
Expand Down