Add support for uploading clipboard image as jpeg
[einar-bin] / getlatestminecraftserver.bash
1 #!/bin/bash
2 # A quick and dirty script to fetch the latest stable minecraft_server.jar
3
4 VERSION_URL="https://launchermeta.mojang.com/mc/game/version_manifest.json"
5 LATEST_VER=$(wget -qO - "${VERSION_URL}" | jq -r .latest.release)
6 # Our CURRENT_VER is stored in current_ver and we don't need no stinking error messages
7
8 source current_ver > /dev/null 2>&1
9
10 # Check if we need a new minecraft_server.jar
11 if [ ! "${CURRENT_VER:-1}" = "${LATEST_VER}" ] || [ ! -f minecraft_server.jar ]; then
12 LATEST_MANIFEST=$(wget -qO - "${VERSION_URL}" | jq -r --arg VERSION_TARGET "${LATEST_VER}" '.versions | .[] | select(.id==$VERSION_TARGET) | .url')
13 LATEST_SERVER_URL=$(wget -qO - "${LATEST_MANIFEST}" | jq -r .downloads.server.url)
14 wget -q "${LATEST_SERVER_URL}" -O minecraft_server.jar && echo "CURRENT_VER=${LATEST_VER}" > current_ver
15 fi