Last active
December 17, 2020 08:46
-
-
Save stellartux/f9eabd2d50284c3eb4197f5d4abc3d6d to your computer and use it in GitHub Desktop.
Mindustry Server Update Script
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
#!/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