Spaces:
Sleeping

foxdec / fetch
ejschwartz's picture
Add SEFM 2020 decompilation and download Zenodo artifacts in the build
83a9a5a
Raw History Blame Contribute Delete
471 Bytes
#!/bin/sh
set -eu
cached=/downloads/$2
check() { printf '%s %s\n' "$2" "$1" | sha256sum --check - >/dev/null 2>&1; }
if [ -d /downloads ] && check "$cached" "$2"; then
cp "$cached" "$3"
else
# Zenodo rejects curl's default User-Agent
curl --fail --location --silent --show-error --http1.1 --retry 3 --retry-all-errors \
-A 'Wget/1.21' "$1" -o "$3"
printf '%s %s\n' "$2" "$3" | sha256sum --check -
! [ -d /downloads ] || cp "$3" "$cached"
fi