From 04c4face59de67e5d67abf2a4cd690ea6e6fd8d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Wed, 9 Jan 2013 12:07:50 +0100 Subject: [PATCH] =?utf8?q?Oppdatert=20minecraft.sh=20til=20=C3=A5=20h?= =?utf8?q?=C3=A5ndtere=20oppdatering=20av=20Minecraft-versjoner,=20samt=20?= =?utf8?q?liste=20opp=20tilgjengelige=20versjoner.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- minecraft.sh | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/minecraft.sh b/minecraft.sh index 93cdbdc..007e147 100755 --- a/minecraft.sh +++ b/minecraft.sh @@ -27,16 +27,29 @@ MC_COMMAND="java -Xmx2048M -Xms1024M -cp ${MC_LAUNCHER} net.minecraft.LauncherFr # 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/" +export LD_LIBRARY_PATH="/usr/java/latest/lib/amd64/" # Here comes the code -if [ ${#} -ne 1 ]; then - echo "Usage: 'minecraft '" +UPDATEMC=0 + +if [ ${#} -lt 1 ]; then + echo "Usage: 'minecraft ' or 'minecraft --add '" exit 1 fi +if [ "${1}" == "--add" ]; then + if [ "${#}" -ne 2 ]; then + echo "You must supply what version you are adding: 'minecraft --add '" + exit 1 + else + MC_NEW_FOLDER="${MC_HOME}/bin-${2}" + read -p "Will save new bin-folder called bin-${2}, press update when prompted." + UPDATEMC=1 + fi +fi + if [ -z ${MC_HOME} ]; then echo "Minecraft home folder not set! Baaaad idea!" exit 1 @@ -47,11 +60,19 @@ if [ ! -d ${MC_HOME} ]; then exit 1 fi -MC_VERSION_FOLDER="${MC_HOME}/bin-${1}" +if [ ${UPDATEMC} -ne 1 ]; then + MC_VERSION_FOLDER="${MC_HOME}/bin-${1}" +else + MC_VERSION_FOLDER=$(ls -d ${MC_HOME}/bin-* | tail -n 1) +fi + MC_WORKING_FOLDER="${MC_HOME}/bin" if [ ! -d "${MC_VERSION_FOLDER}" ]; then - echo "Could not find that version folder (${MC_WORKING_FOLDER})." + echo "Could not find that version folder (${MC_VERSION_FOLDER})" + echo -e "\nAvailable Minecraft versions are:" + echo "---------------------------------" + ls -d ${MC_HOME}/bin-* | cut -d "-" -f 2 exit 1 fi @@ -65,4 +86,7 @@ fi if [ ! -e "${MC_WORKING_FOLDER}" ]; then cp -r ${MC_VERSION_FOLDER} ${MC_WORKING_FOLDER} ${MC_COMMAND} + if [ ${UPDATEMC} == 1 ]; then + cp -r ${MC_WORKING_FOLDER} ${MC_NEW_FOLDER} + fi fi -- 2.30.2