14 lines
760 B
Bash
Executable file
14 lines
760 B
Bash
Executable file
#!/bin/bash
|
|
|
|
curl 'https://papermc.io/api/v2/projects/velocity/version_group/3.0.0/builds' -H 'User-Agent: docker-build simcop2387@simcop2387.info' | jq -r '.builds[-1]' | tee /tmp/velocity.json
|
|
wget -O /tmp/velocity.jar $(jq -r '"https://papermc.io/api/v2/projects/velocity/versions/"+(.version|tostring)+"/builds/"+(.build|tostring)+"/downloads/"+ (.downloads.application.name|tostring)' < /tmp/velocity.json)
|
|
CALCULATED=$(sha256sum /tmp/velocity.jar | cut -d' ' -f1)
|
|
PROVIDED=$(jq -r '.downloads.application.sha256' < /tmp/velocity.json)
|
|
|
|
if [[ $CALCULATED == $PROVIDED ]]; then
|
|
echo download successful, moving to final location
|
|
mv /tmp/velocity.jar /velocity/
|
|
else
|
|
echo FAILED SHA256 SUM CHECK: $CALCULATED !=
|
|
exit 127
|
|
fi
|