-
-
Save fernferret/f43a6c1eeded0bf7f795 to your computer and use it in GitHub Desktop.
Bash script to update all/any MV plugins.
This file contains 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 | |
#/****************************************************************************** | |
# * Multiverse 2 Copyright (c) the Multiverse Team 2011. * | |
# * Multiverse 2 is licensed under the BSD License. * | |
# * For more information please check the README.md file included * | |
# * with this project. * | |
# ******************************************************************************/ | |
# Usage: ./updatemv.sh { [S]table | [B]eta | [L]ocal } [VERSION] | |
# ./updatemv.sh Plugin {NAME} [BUILD]' | |
##### THINGS YOU CAN TOUCH | |
# This is a list of the plugins you want. Default is: | |
# All values are: Core, Portals, NetherPortals, SignPortals and Adventure (Adventure is not yet published, but will be soon.) | |
# If you don't use NetherPortals, simply remove it from the list | |
pluginsToUpdate=( "Core" "Portals" "NetherPortals" "SignPortals" ) | |
# If you want to use local builds, where are they located | |
mvrootdir="/Users/fernferret/Documents/minecraftdev/mv2" | |
# Folders in that folder must be the names of the plugins without Multiverse: | |
# Core, Portals, NetherPortals, SignPortals and Adventure | |
# The version, only used for local builds. This | |
mvv="2.1" | |
##### DONT TOUCH BELOW HERE | |
##### DONT TOUCH BELOW HERE | |
##### DONT TOUCH BELOW HERE | |
##### DONT TOUCH BELOW HERE | |
##### DONT TOUCH BELOW HERE | |
# Disable case sensitiviy | |
shopt -s nocasematch | |
version="1.0" | |
usage='Usage: \n./updatemv.sh { [S]table | [B]eta | [L]ocal } [VERSION]\n./updatemv.sh Plugin {NAME} [BUILD]' | |
allPlugins=( "Core" "Portals" "NetherPortals" "SignPortals" "Adventure" ) | |
if [ -z "$1" ] | |
then | |
echo -e $usage | |
exit 0 | |
elif [[ "$1" =~ (s)(table)? ]] | |
then | |
if [ ! -z "$2" ] | |
then | |
mvv="$2" | |
fi | |
echo "Using Stable Multiverse Builds..." | |
for plugin in "${pluginsToUpdate[@]}" | |
do | |
echo "Removing and re-downloading Multiverse-${plugin}.jar" | |
rm "Multiverse-${plugin}.jar" | |
lowercase=`echo "${plugin}" | tr '[A-Z]' '[a-z]'` | |
wget "http://bukkit.onarandombox.com/multiverse-${lowercase}/Multiverse-${plugin}.jar" | |
done | |
elif [[ "$1" =~ Plugin ]] | |
then | |
if [ ! -z "$3" ]; | |
then | |
echo "Going to try to update ${2} to build ${3}..." | |
rm "Multiverse-${2}.jar" | |
wget "http://ci.onarandombox.com/job/Multiverse-${2}/${3}/artifact/target/Multiverse-${2}-${mvv}.jar" | |
mv "Multiverse-${2}-${mvv}.jar" "Multiverse-${2}.jar" | |
exit 0 | |
fi | |
echo -e $usage | |
exit 0 | |
elif [[ "$1" =~ (b)(eta)? ]] | |
then | |
# START GET LATEST VERSION | |
wget "https://raw.github.com/Multiverse/Multiverse-Core/master/pom.xml" | |
mvv=`awk ' | |
/<version>/,/<\/version>/ { | |
gsub(/.*<version>|<\/version>.*/,""); | |
print; | |
exit | |
}; | |
' pom.xml` | |
rm pom.xml | |
# END | |
for plugin in "${pluginsToUpdate[@]}" | |
do | |
echo "Removing and re-downloading Multiverse-${plugin}.jar" | |
rm "Multiverse-${plugin}.jar" | |
lowercase=`echo "${plugin}" | tr '[A-Z]' '[a-z]'` | |
wget "http://ci.onarandombox.com/job/Multiverse-${plugin}/lastSuccessfulBuild/artifact/target/Multiverse-${plugin}-${mvv}.jar" | |
mv "Multiverse-${plugin}-${mvv}.jar" "Multiverse-${plugin}.jar" | |
done | |
elif [[ "$1" =~ (l)(ocal)? ]] | |
then | |
if [ ! -z "$2" ] | |
then | |
mvv="$2" | |
fi | |
echo "Using Local Multiverse Builds..." | |
for plugin in "${pluginsToUpdate[@]}" | |
do | |
echo "Removing and re-linking Multiverse-${plugin}.jar" | |
rm "Multiverse-${plugin}.jar" | |
ln -s "${mvrootdir}/${plugin}/target/Multiverse-${plugin}-${mvv}.jar" "Multiverse-${plugin}.jar" | |
done | |
else | |
echo "Please use one of the following:" | |
echo -e $usage | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment