Pahanda
New member
This was originally written by Zombie Feynman (#1886944). I honestly can't remember where I got it from (and I can't find it here), but I've made a few changes to it myself and found it to be quiet useful.
After coming back from a brief vacation, I found that the builds have moved to Jenkins (yay!) but that the script no longer worked (boo!).
So I fixed it, and decided to share it with other folks who are of the Linux persuasion (although it should be fine under Cygwin or Mac OS, too, if you've got the necessary tools installed). And because it works on the new build system, I felt that a new thread was in order.
You'll need curl and to have java in your PATH.
Have fun!
After coming back from a brief vacation, I found that the builds have moved to Jenkins (yay!) but that the script no longer worked (boo!).
So I fixed it, and decided to share it with other folks who are of the Linux persuasion (although it should be fine under Cygwin or Mac OS, too, if you've got the necessary tools installed). And because it works on the new build system, I felt that a new thread was in order.
You'll need curl and to have java in your PATH.
Have fun!
Code:
#!/bin/bash
# Originally written by Zombie Feynman (#1886944), a Curious Character.
# Tweaked and updated for Jenkins build system by NeppyMan (#1232476).
# Download the latest build ...
LATEST=$(curl ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/ | grep -o 'KoLmafia-[0-9][0-9][0-9][0-9][0-9].jar' | head -1)
# Check whether the current build is already present. If it is, don't bother downloading it again.
# The filename for KoLmafia is 18 characters long, and that seems unlikely to change in the near future.
# This is a bit of a hacky solution, though ...
if [ -f ${LATEST:(-18)} ]
then
echo "Latest KoLmafia build already present."
else
echo "Fetching latest KoLmafia build."
curl -O http://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/$LATEST
# Dump all but the most recent (to avoid filling up the directory) ...
ls -tr *jar | head -n -1 | xargs rm
fi
# Launch the newest build on-hand ...
LAUNCH=$(ls *jar | head -1)
java -jar $LAUNCH &>/dev/null &disown
exit 0