From 5028e1e0668493bc43529a4f33d1530ae978e3df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Thu, 2 Aug 2012 15:10:03 +0200 Subject: [PATCH] =?utf8?q?minecraft.sh=20-=20kj=C3=B8r=20en=20oppgitt=20mi?= =?utf8?q?necraft-versjon?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- minecraft.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 minecraft.sh diff --git a/minecraft.sh b/minecraft.sh new file mode 100755 index 0000000..70b1bf6 --- /dev/null +++ b/minecraft.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# This script assumes that you have prepared various versions of +# Minecraft bin folders in your $MC_HOME like this: +# ${MC_HOME}/bin-version (example: ${MC_HOME}/bin-1.2.5) +# +# The script tries to preserve the various versions of the bin folder +# by copying the selected bin folder to a "working folder", to prevent +# accidental updates on launch. +# +# Use at your own risk, changing minecraft versions around may result in +# unexpected and undesirable behaviour. You may lose your saves. +# This script does not handle backups of the world data, I suggest using +# deja-dup or similar backup software. It's good for you. + +# Written by Einar Jørgen Haraldseid +# inspired by a similar idea by Lars Erik Pedersen + +# Released to the public under the WTFPL: http://sam.zoy.org/wtfpl/COPYING + +# CONFIG STUFF - change these to suit your system +MC_HOME="${HOME}/.minecraft" +MC_LAUNCHER="${HOME}/bin/minecraft.jar" +MC_COMMAND="java -Xmx2048M -Xms1024M -cp ${MC_LAUNCHER} net.minecraft.LauncherFrame" + +# This might be needed to fix 64bit java on Linux (path to your 64bit java libs) +# Uncomment this if not suitable. +export LD_LIBRARY_PATH="/usr/lib/jvm/jre/lib/amd64/" + + +# Here comes the code + +if [ ${#} -ne 1 ]; then + echo "Usage: 'minecraft '" + exit 1 +fi + +MC_VERSION_FOLDER="${MC_HOME}/bin-${1}" +MC_WORKING_FOLDER="${MC_HOME}/bin" + +if [ ! -d "${MC_VERSION_FOLDER}" ]; then + echo "Could not find that version folder." + exit 1 +fi + +if [ -d "${MC_WORKING_FOLDER}" ]; then + rm -rf ${MC_WORKING_FOLDER} +elif [ ! -d "${MC_WORKING_FOLDER}" ]; then + echo "Minecraft bin folder is not a directory, bailing out." + exit 1 +fi + +if [ ! -e "${MC_WORKING_FOLDER}" ]; then + cp -r ${MC_VERSION_FOLDER} ${MC_WORKING_FOLDER} + ${MC_COMMAND} +fi -- 2.30.2