2 # This script assumes that you have prepared various versions of
3 # Minecraft bin folders in your $MC_HOME like this:
4 # ${MC_HOME}/bin-version (example: ${MC_HOME}/bin-1.2.5)
6 # The script tries to preserve the various versions of the bin folder
7 # by copying the selected bin folder to a "working folder", to prevent
8 # accidental updates on launch.
10 # Use at your own risk, changing minecraft versions around may result in
11 # unexpected and undesirable behaviour. You may lose your saves.
12 # This script does not handle backups of the world data, I suggest using
13 # deja-dup or similar backup software. It's good for you.
15 # Written by Einar Jørgen Haraldseid <einar@haraldseid.net>
16 # inspired by a similar idea by Lars Erik Pedersen
18 # Released to the public under the WTFPL: http://sam.zoy.org/wtfpl/COPYING
20 # CONFIG STUFF - change these to suit your system
21 # Minecraft home folder, where the binaries and saves and stuff are stored:
22 MC_HOME
="${HOME}/.minecraft"
23 # Location and filename for the Minecraft launcher jar:
24 MC_LAUNCHER
="${HOME}/bin/minecraft.jar"
25 # Command line to run to start Minecraft:
26 MC_COMMAND
="java -Xmx2048M -Xms1024M -cp ${MC_LAUNCHER} net.minecraft.LauncherFrame"
28 # This might be needed to fix 64bit java on Linux (path to your 64bit java libs)
29 # Uncomment this if not suitable.
30 export LD_LIBRARY_PATH
="/usr/java/latest/lib/amd64/"
37 if [ ${#} -lt 1 ]; then
38 echo "Usage: 'minecraft <version>' or 'minecraft --add <version>'"
42 if [ "${1}" == "--add" ]; then
43 if [ "${#}" -ne 2 ]; then
44 echo "You must supply what version you are adding: 'minecraft --add <version>'"
47 MC_NEW_FOLDER
="${MC_HOME}/bin-${2}"
48 read -p "Will save new bin-folder called bin-${2}, press update when prompted."
53 if [ -z ${MC_HOME} ]; then
54 echo "Minecraft home folder not set! Baaaad idea!"
58 if [ ! -d ${MC_HOME} ]; then
59 echo "Minecraft home folder (${MC_HOME}) not found!"
63 if [ ${UPDATEMC} -ne 1 ]; then
64 MC_VERSION_FOLDER
="${MC_HOME}/bin-${1}"
66 MC_VERSION_FOLDER
=$
(ls -d ${MC_HOME}/bin-
* |
tail -n 1)
69 MC_WORKING_FOLDER
="${MC_HOME}/bin"
71 if [ ! -d "${MC_VERSION_FOLDER}" ]; then
72 echo "Could not find that version folder (${MC_VERSION_FOLDER})"
73 echo -e "\nAvailable Minecraft versions are:"
74 echo "---------------------------------"
75 ls -d ${MC_HOME}/bin-
* | cut
-d "-" -f 2
79 if [ -d "${MC_WORKING_FOLDER}" ]; then
80 rm -rf ${MC_WORKING_FOLDER}
81 elif [ ! -d "${MC_WORKING_FOLDER}" ]; then
82 echo "Minecraft bin folder (${MC_WORKING_FOLDER}) is not a directory, bailing out."
86 if [ ! -e "${MC_WORKING_FOLDER}" ]; then
87 cp -r ${MC_VERSION_FOLDER} ${MC_WORKING_FOLDER}
89 if [ ${UPDATEMC} == 1 ]; then
90 cp -r ${MC_WORKING_FOLDER} ${MC_NEW_FOLDER}