Skip to content

Instantly share code, notes, and snippets.

@stellartux
Last active December 17, 2020 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stellartux/f9eabd2d50284c3eb4197f5d4abc3d6d to your computer and use it in GitHub Desktop.
Save stellartux/f9eabd2d50284c3eb4197f5d4abc3d6d to your computer and use it in GitHub Desktop.
Mindustry Server Update Script
#!/usr/bin/env sh
# Checks if latest version matches the last version downloaded, and if it doesn't, downloads the latest
downloadurl=$(curl -s https://github.com/Anuken/Mindustry/releases/latest/download/server-release.jar \
| grep -o -P '(?<=a href=").*(?=")' -)
latestversion=$(echo $downloadurl | grep -o -P '(?<=/)v[\d.]+(?=/)')
currentversion=$(if [ -f "version.txt" ]; then
cat version.txt
else
echo "v0.0"
fi)
if [ $currentversion != $latestversion ]; then
echo "Updating $currentversion to $latestversion"
wget -O "server-release.jar" $downloadurl
echo $latestversion > version.txt
else
echo "Already using latest $currentversion"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment