From cdf561593ae49dcb62bd4b07c2666812a68f3efe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Thu, 7 Apr 2016 17:08:07 +0200 Subject: [PATCH 1/1] Stupid, little script to download latest Minecraft server version --- getlatestminecraftserver.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 getlatestminecraftserver.bash diff --git a/getlatestminecraftserver.bash b/getlatestminecraftserver.bash new file mode 100755 index 0000000..74be0f5 --- /dev/null +++ b/getlatestminecraftserver.bash @@ -0,0 +1,14 @@ +#!/bin/bash +# A quick and dirty script to fetch the latest stable minecraft_server.jar +# URL https://s3.amazonaws.com/Minecraft.Download/versions/1.9.2/minecraft_server.1.9.2.jar + +BASE_URL="https://s3.amazonaws.com/Minecraft.Download/versions" +VERSION_URL="https://launchermeta.mojang.com/mc/game/version_manifest.json" +LATEST_VER=$(wget -qO - ${VERSION_URL} | python -m json.tool | grep "\"release\":" | cut -d '"' -f 4) +# Our CURRENT_VER is stored in current_ver and we don't need no stinking error messages +source current_ver > /dev/null 2>&1 + +if [ ! ${CURRENT_VER:-1} = ${LATEST_VER} ] || [ ! -f minecraft_server.jar ]; then + wget -q ${BASE_URL}/${LATEST_VER}/minecraft_server.${LATEST_VER}.jar -O minecraft_server.jar && \ + echo "CURRENT_VER=${LATEST_VER}" > current_ver +fi -- 2.30.2