2 # A quick and dirty script to fetch the latest stable minecraft_server.jar
3 # URL https://s3.amazonaws.com/Minecraft.Download/versions/1.9.2/minecraft_server.1.9.2.jar
5 BASE_URL
="https://s3.amazonaws.com/Minecraft.Download/versions"
6 VERSION_URL
="https://launchermeta.mojang.com/mc/game/version_manifest.json"
7 LATEST_VER
=$
(wget
-qO - ${VERSION_URL} | python
-m json.tool |
grep "\"release\":" | cut
-d '"' -f 4)
8 # Our CURRENT_VER is stored in current_ver and we don't need no stinking error messages
9 source current_ver
> /dev
/null
2>&1
11 if [ ! ${CURRENT_VER:-1} = ${LATEST_VER} ] ||
[ ! -f minecraft_server.jar
]; then
12 wget
-q ${BASE_URL}/${LATEST_VER}/minecraft_server.${LATEST_VER}.jar
-O minecraft_server.jar
&& \
13 echo "CURRENT_VER=${LATEST_VER}" > current_ver