summarylogtreecommitdiffstats
path: root/minecraft
diff options
context:
space:
mode:
authorChristophe Robin2017-01-30 11:08:21 +0900
committerChristophe Robin2017-01-30 11:08:21 +0900
commit29acd4fce0667fc0210b6385875a20958a984a86 (patch)
tree3c054369c7ef24dcdb0f28ea2f352fdeb7aa6784 /minecraft
parent09b08cf62ee4e8ded367c9dfa47661b1bafa4dcf (diff)
downloadaur-29acd4fce0667fc0210b6385875a20958a984a86.tar.gz
Added force update mechanism to cope with old launchers
Diffstat (limited to 'minecraft')
-rwxr-xr-xminecraft21
1 files changed, 20 insertions, 1 deletions
diff --git a/minecraft b/minecraft
index 3d87bec21f95..5d27e917394d 100755
--- a/minecraft
+++ b/minecraft
@@ -1,7 +1,26 @@
#!/bin/sh
-if [ -e "${HOME}/.minecraft/launcher.jar" ]; then
+# Since launching the minecraft launch from the home directory bypass the update mechanism, I'm adding this
+# small piece of code that will do a checksum of the versions.json file provided by mojang, if a new version
+# of the game is out, I force a download of the launcher just to keep everyone up to date
+
+# those 2 can be overrided if you want
+MC_VERSION_URL=${MC_VERSION_URL:-"https://launchermeta.mojang.com/mc/game/version_manifest.json"}
+MC_SUM_FILE=${MC_SUM_FILE:-"${HOME}/.minecraft/versions.sum"}
+
+# compute sums
+MC_VERSION_SUM=$( curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | sha256sum | cut -f 1 -d " " )
+MC_CURRENT_SUM=$( cat "$MC_SUM_FILE" 2>/dev/null )
+
+if [ "$MC_VERSION_SUM" != "$MC_CURRENT_SUM" ]; then
+ export MC_FORCE_UPDATE=1
+ echo "$MC_VERSION_SUM" > "$MC_SUM_FILE"
+fi
+
+if [ -e "${HOME}/.minecraft/launcher.jar" ] && [ -z "$MC_FORCE_UPDATE" ]; then
exec java -jar "${HOME}/.minecraft/launcher.jar" $@
else
exec java -jar /usr/share/minecraft/Minecraft.jar $@
fi
+
+unset MC_FORCE_UPDATE \ No newline at end of file