Created
January 20, 2015 16:54
-
-
Save Korko/8c9d9a416fbc474830af to your computer and use it in GitHub Desktop.
Minecraft management script : Handle ATLauncher modpack check version and update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PACK_NAME="DNSTechpack" | |
SERVER_FILE=$2 | |
usage() { | |
echo "Usage: $0 {get|update} (new version file)" | |
return 1 | |
} | |
getVersion() { | |
wget http://www.atlauncher.com/pack/$PACK_NAME/ -q -O /tmp/${PACK_NAME}_version | |
sed -nr 's/<a .* href="(.*)">Download Server<\/a>/\1/p' /tmp/${PACK_NAME}_version | |
unlink /tmp/${PACK_NAME}_version | |
return 0 | |
} | |
updateVersion() { | |
echo " * Removing the old executable" | |
rm -Rf "forge-*.jar" minecraft_server.jar libraries liteconfig mods options.txt pack.json scripts | |
echo " * Linking to the new version" | |
unzip -qq -d /tmp/$PACK_NAME "$SERVER_FILE" | |
mv -n /tmp/$PACK_NAME/* . | |
rm -Rf /tmp/$PACK_NAME | |
ln -s $(ls forge-*.jar) minecraft_server.jar | |
return 0 | |
} | |
case "$1" in | |
get) | |
getVersion | |
;; | |
update) | |
updateVersion | |
;; | |
*) | |
usage | |
;; | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment