Skip to content

Instantly share code, notes, and snippets.

@airtonix
Created May 21, 2011 09:20
Show Gist options
  • Save airtonix/984391 to your computer and use it in GitHub Desktop.
Save airtonix/984391 to your computer and use it in GitHub Desktop.
Simple minecraft mod installer for mods that require .class files to be inside the ~/.minecraft/bin/mnecraft.jar file.
#!/bin/sh
TIMESTAMP=`date +%Y%m%d-%H%M%S`
INSTALLATION_TEMP=/tmp/minecraft
MINECRAFT_BIN=~/.minecraft/bin
MINECRAFT_BACKUPS=$MINECRAFT_BIN/../backups
# make our temporary directory
echo "Creating temporary directory"
mkdir $INSTALLATION_TEMP -p
# make our backup directory
echo "Creating backup directory"
mkdir $MINECRAFT_BACKUPS -p
echo "Making a backup of $MINECRAFT_BIN/minecraft.jar to $MINECRAFT_BACKUPS/$TIMESTAMP-minecraft.jar"
cp $MINECRAFT_BIN/minecraft.jar $MINECRAFT_BACKUPS/$TIMESTAMP-minecraft.jar
# Unpack Minecraft to the temporary directory
cd $INSTALLATION_TEMP
echo "Unpacking $MINECRAFT_BIN/minecraft.jar to ${PWD}"
jar xf $MINECRAFT_BIN/minecraft.jar
# Wait for user to dump files into temporary directory
echo "Drop your files into ${PWD}"
read INPUT
echo "Removing ${PWD}/META-INF/MOJANG_C.*"
# Remove the MetaDescription Data
rm ./META-INF/MOJANG_C.*
echo "Repacking to ${MINECRAFT_BIN}/minecraft.jar"
# Repack the fils into the minecraft jar binary
jar uf $MINECRAFT_BIN/minecraft.jar ./
echo "Removing temporary directory. ${INSTALLATION_TEMP}"
# Remove the temporary directory
cd ~
rm $INSTALLATION_TEMP -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment