Skip to content
Permalink
Browse files

Fix MD5 download checking to work on OS X

PiperOrigin-RevId: 242719576
  • Loading branch information
petewarden authored and tensorflower-gardener committed Apr 9, 2019
1 parent 16d7642 commit 7359dd33d9d253aa3194c44b4cc3f9a65cfe4f45
Showing with 5 additions and 7 deletions.
  1. +5 −7 tensorflow/lite/experimental/micro/tools/make/download_and_extract.sh
@@ -82,13 +82,11 @@ download_and_extract() {
echo "downloading ${url}" >&2
mkdir -p "${dir}"
curl -Ls "${url}" > ${tempfile}
# Two spaces are needed as separator below.
echo "${expected_md5} ${tempfile}" > ${tempdir}/md5.txt
MD5_STATUS=0
md5sum --check ${tempdir}/md5.txt 1>/dev/null 2>/dev/null || MD5_STATUS=$? && true
if [ ${MD5_STATUS} -ne 0 ]; then
echo "Checksum error for '${url}'. Expected ${expected_md5} but found"
echo `md5sum ${tempfile}`

# Check that the file was downloaded correctly using a checksum.
DOWNLOADED_MD5=$(openssl dgst -md5 ${tempfile} | sed 's/.* //g')
if [ ${expected_md5} != ${DOWNLOADED_MD5} ]; then
echo "Checksum error for '${url}'. Expected ${expected_md5} but found ${DOWNLOADED_MD5}"
exit 1
fi

0 comments on commit 7359dd3

Please sign in to comment.
You can’t perform that action at this time.