Last active
March 31, 2016 07:24
-
-
Save tmad40blue/74aa049b38a71bacfc6a to your computer and use it in GitHub Desktop.
BuildTools auto-updater
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
# Bash safety stuff | |
set -o errexit | |
# Environemnt variables | |
DIRECTORY="/home/minecraft" # Working directory for BuildTools (NOT your server directory - please make a separate one) | |
SERVDIR="/home/minecraft/servers/spigot_server" # The actual directory where your Spigot server is | |
MAXRAM="16" # How much RAM (in GB) to allocate to BuildTools - default is 1GB | |
### DO NOT CHANGE ANYTHING BELOW THIS LINE ### | |
### ###################################### ### | |
### ###################################### ### | |
### ###################################### ### | |
clear | |
echo -e "\n \n \n" | |
echo -e "$(tput bold)$(tput smul)BuildTools Automatic Updater Script$(tput rmul) $(tput sgr 0)" | |
echo -e "$(tput bold)Written by $(tput setaf 6)tmad40blue $(tput sgr 0) -- $(tput setaf 4)http://tmad40.blue/ $(tput sgr 0)" | |
echo -e "$(tput dim)Version 1.1 $(tput sgr 0)" | |
echo -e "\n \n \n" | |
sleep 1 | |
echo -e "$(tput setaf 3)Running BuildTools and compiling the latest Spigot and CraftBukkit JAR files...$(tput sgr 0)" | |
echo -e "$(tput setaf 1)$(tput bold)$(tput blink)!!! THIS WILL TAKE A LONG TIME !!!$(tput sgr 0)" | |
sleep 3 | |
# Change to working directory | |
cd $DIRECTORY | |
# Remove old build artifacts if present | |
rm -rf .m2 | |
rm -rf _buildtools | |
# Create and change to new build directory | |
mkdir "_buildtools" | |
cd "_buildtools" | |
# Download latest BuildTools from Spigot hub | |
wget -O "BuildTools.jar" "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar" | |
# Configure git | |
# git config --global --unset core.autocrlf # Uncomment this line if git complains about configuration or username/password stuff | |
sleep 2 | |
# Start it up! | |
java -d64 -Xms512M -Xmx${MAXRAM}G -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -jar BuildTools.jar --rev latest | |
# All done - change to working directory and copy built Spigot JAR file to server directory | |
echo -e "$(tput setaf 2)Update complete! $(tput sgr 0)Cleaning up..." | |
cd $DIRECTORY | |
cp _buildtools/spigot-*.jar ${SERVDIR}/spigot.jar | |
# Remove build artifacts | |
rm -rf .m2 | |
rm -rf _buildtools | |
# Goodbye | |
tput clear | |
echo "$(tput setaf 2)All done! $(tput sgr 0)The latest Spigot should now be in your server directory." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment