Skip to content

Instantly share code, notes, and snippets.

@mja00
Created November 25, 2021 16:08
Show Gist options
  • Save mja00/869f2dea8ca5ccd055176b51c20dd3d1 to your computer and use it in GitHub Desktop.
Save mja00/869f2dea8ca5ccd055176b51c20dd3d1 to your computer and use it in GitHub Desktop.
Download latest Paper one liner
# Downloads latest version and zips it into a nice little package :)
latestVersion=$(curl -X GET "https://papermc.io/api/v2/projects/paper" -H "accept: application/json" --silent | jq '.versions[-1]' | sed 's/"//g'); versionURL=$(echo "" | awk -v latestVersion="$latestVersion" '{print $1"https://papermc.io/api/v2/projects/paper/versions/"latestVersion}'); buildnumber=$(curl -X GET $versionURL -H "accept: application/json" --silent | jq '.builds[-1]'); buildurl=$(curl -X GET "https://papermc.io/api/v2/projects/paper/versions/${latestVersion}/builds/${buildnumber}" -H "accept: application/json" --silent | jq '.downloads.application.name' | sed 's/"//g' | awk -v latestversion="$latestVersion" -v buildnumber="$buildnumber" '{print "https://papermc.io/api/v2/projects/paper/versions/"latestversion"/builds/"buildnumber"/downloads/"$1}'); curl -JO $buildurl; jarname=$(find . -name *.jar -exec basename {} .jar \;); zip -m $jarname.zip `find . -name *.jar -print`; sha256sum $jarname.zip
# Downloads latest and doesn't do anything else
latestVersion=$(curl -X GET "https://papermc.io/api/v2/projects/paper" -H "accept: application/json" --silent | jq '.versions[-1]' | sed 's/"//g'); versionURL=$(echo "" | awk -v latestVersion="$latestVersion" '{print $1"https://papermc.io/api/v2/projects/paper/versions/"latestVersion}'); buildnumber=$(curl -X GET $versionURL -H "accept: application/json" --silent | jq '.builds[-1]'); buildurl=$(curl -X GET "https://papermc.io/api/v2/projects/paper/versions/${latestVersion}/builds/${buildnumber}" -H "accept: application/json" --silent | jq '.downloads.application.name' | sed 's/"//g' | awk -v latestversion="$latestVersion" -v buildnumber="$buildnumber" '{print "https://papermc.io/api/v2/projects/paper/versions/"latestversion"/builds/"buildnumber"/downloads/"$1}'); curl -JO $buildurl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment