Last active
May 30, 2016 14:25
-
-
Save dzabel/6743f5a0a9e00f4634ce42f6caff518e to your computer and use it in GitHub Desktop.
filedownload - verify checksum
This file contains hidden or 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
#!/bin/bash | |
DL_URL='http://my-remote-url' | |
# assumes that for each file a same file with .sha256 extension exists | |
DUMPS="dlfile1 dlfile2" | |
for i in ${DUMPS}; do | |
while [ "x$(curl --silent "${DL_URL}/${i}.sha256" -o ${i}.sha256 && cat ${i}.sha256 | cut -d ' ' -f 1)" != "x$(sha256sum "${i}" 2>/dev/null | cut -d ' ' -f 1)" ]; do | |
echo "Downloading file ${i} ..." | |
curl --silent -L -O ${DL_URL}/${i} | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment