blob: c1c050c4f56abdc639d282ae9db37687a18fcffe (
plain)
1 #!/bin/sh
2
3 # We need to force Java 8 here since both Java 7 and 9 currently causes the game to crash
4 export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:/usr/lib/jvm/java-8-jre/jre/bin/:$PATH
5
6 # Since launching the minecraft launch from the home directory bypass the update mechanism, I'm adding this
7 # small piece of code that will do a checksum of the versions.json file provided by mojang, if a new version
8 # of the game is out, I force a download of the launcher just to keep everyone up to date
9
10 # those 2 can be overrided if you want
11 MC_VERSION_URL=${MC_VERSION_URL:-"https://launchermeta.mojang.com/mc/game/version_manifest.json"}
12 MC_SUM_FILE=${MC_SUM_FILE:-"${HOME}/.minecraft/versions.sum"}
13
14 # compute sums
15 MC_VERSION_SUM=$( curl -s "${MC_VERSION_URL}" | sha256sum | cut -f 1 -d " " )
16 MC_CURRENT_SUM=$( cat "$MC_SUM_FILE" 2>/dev/null )
17
18 if [ "$MC_VERSION_SUM" != "$MC_CURRENT_SUM" ]; then
19 export MC_FORCE_UPDATE=1
20 echo "$MC_VERSION_SUM" > "$MC_SUM_FILE"
21 fi
22
23 if [ -e "${HOME}/.minecraft/launcher.jar" ] && [ -z "$MC_FORCE_UPDATE" ]; then
24 exec java -jar "${HOME}/.minecraft/launcher.jar" $@
25 else
26 exec java -jar /usr/share/minecraft/Minecraft.jar $@
27 fi
28
29 unset MC_FORCE_UPDATE
|