Skip to content

Instantly share code, notes, and snippets.

@bdero
Created August 9, 2012 14:17
Show Gist options
  • Save bdero/3304565 to your computer and use it in GitHub Desktop.
Save bdero/3304565 to your computer and use it in GitHub Desktop.
Tiny Minecraft setup script
#!/bin/bash
#
# mc.sh - Tiny Minecraft setup script
#
# Copyright (C) 2012 Brandon DeRosier
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
if [ "$1" == "get" ]; then
mkdir -p ~/minecraft/client/
mkdir ~/minecraft/server/
wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar
mv minecraft.jar ~/minecraft/client/
touch ~/minecraft/client/run.sh
echo "java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame" > ~/minecraft/client/run.sh
chmod +x ~/minecraft/client/run.sh
wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
mv minecraft_server.jar ~/minecraft/server/
touch ~/minecraft/server/run.sh
echo "java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui" > ~/minecraft/server/run.sh
chmod +x ~/minecraft/server/run.sh
elif [ "$1" == "patch" ]; then
mkdir -p ~/minecraft/tmp/
wget http://www.newdawnsoftware.com/jenkins/view/LWJGL/job/LWJGL/lastSuccessfulBuild/artifact/dist/lwjgl-2.8.5.zip
mv lwjgl-2.8.5.zip ~/minecraft/tmp/
unzip ~/minecraft/tmp/lwjgl-2.8.5.zip -d ~/minecraft/tmp/
mv ~/minecraft/tmp/lwjgl-2.8.5/ ~/minecraft/tmp/lwjgl/
mkdir -p ~/.minecraft/bin/
mv ~/.minecraft/bin/lwjgl.jar ~/.minecraft/bin/lwjgl.jar.bak
cp ~/minecraft/tmp/lwjgl/jar/lwjgl.jar ~/.minecraft/bin/
mv ~/.minecraft/bin/lwjgl_util.jar ~/.minecraft/bin/lwjgl_util.jar.bak
cp ~/minecraft/tmp/lwjgl/jar/lwjgl_util.jar ~/.minecraft/bin/
mv ~/.minecraft/bin/jinput.jar ~/.minecraft/bin/jinput.jar.bak
cp ~/minecraft/tmp/lwjgl/jar/jinput.jar ~/.minecraft/bin/
if [ -d "~/.minecraft/bin/natives/" ]; then
mv ~/.minecraft/bin/natives/ ~/.minecraft/bin/natives.bak/
fi
mkdir ~/.minecraft/bin/natives/
cp ~/minecraft/tmp/lwjgl/native/linux/* ~/.minecraft/bin/natives/
elif [ "$1" == "run" ]; then
java -Xmx1024M -Xms512M -cp ~/minecraft/client/minecraft.jar net.minecraft.LauncherFrame
elif [ "$1" == "runserver" ]; then
java -Xmx1024M -Xms1024M -jar ~/minecraft/server/minecraft_server.jar nogui
elif [ "$1" == "removeall" ]; then
rm -r ~/.minecraft/
rm -r ~/minecraft/
else
echo "Tiny Minecraft setup script -- github.com/CheeseKeg/"
echo " - Directions: 1. Run \"./mc.sh get\" (without quotes)"
echo " 2. Run Minecraft using \"./mc.sh run\" (without quotes)"
echo " 3. Login to Minecraft and update (to experience a black screen)"
echo " 4. Run \"./mc.sh patch\" (without quotes)"
echo " 5. Minecraft should now (hopefully) work -- run Minecraft using \"./mc.sh\""
echo " (6.)You can also run a local Minecraft server using \"./mc.sh runserver\" (without quotes)"
echo " - Usage: ./installminecraft.sh [FUNCTION]"
echo " - FUNCTIONs:"
echo " get -- Create directories and download Minecraft"
echo " patch -- Download and replace bad LWJGL files"
echo " run -- Run the Minecraft client"
echo " runserver -- Run a Minecraft server"
echo " removeall -- Removes all Minecraft data and the ~/minecraft directory"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment