Fetch pre-built artifact if available

This commit is contained in:
Jonas Herzig
2017-10-03 14:36:51 +02:00
parent cceed1258d
commit c07e08386d

View File

@@ -24,6 +24,19 @@ setup_dep () {
[ -f "deps/$dep.jar" ] && [ "*" == "$jarhash" ] && return
rm -rf "deps/$dep.jar"
if [ "*" != "$jarhash" ] && [ "$OFFLINE" != "1" ]; then
# Try to fetch the pre-built artifact
if wget -O "deps/dl.tmp" "https://www.johni0702.de/replaymod/artifact/$jarhash"; then
# Verify downloaded jar file
if [ "$(sha256val "deps/dl.tmp")" == "$jarhash" ]; then
# Got valid pre-built artifact, use it
mv "deps/dl.tmp" "deps/$dep.jar"
return
fi
fi
fi
if [ ! -d "deps/$dep" ] || [ "$(git -C "deps/$dep" rev-parse $commit^{commit})" != "$commit" ]; then
rm -rf "deps/$dep"
mkdir -p "deps/$dep"