Created
April 17, 2020 00:18
-
-
Save artulloss/2f4ffaa4b0f3231ef58bba344b4c8af5 to your computer and use it in GitHub Desktop.
Easily update pocketmine! You can also choose the version to check out by doing ./update.sh <version>
This file contains hidden or 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
rm PocketMine-MP.phar.old 2> /dev/null | |
mv ./PocketMine-MP.phar ./PocketMine-MP.phar.old | |
echo "Backup of old Pocketmine-MP.phar stored at Pocketmine-MP.phar.old" | |
if [ $# -eq 0 ] # Empty arguments | |
then | |
curl -s https://api.github.com/repos/pmmp/Pocketmine-MP/releases/latest \ | |
| grep "browser_download_url.*phar" \ | |
| cut -d : -f 2,3 \ | |
| tr -d \" \ | |
| wget -qi - | |
echo "Updated to latest version!" | |
else # Specified version of pocketmine | |
VERSION=$1 | |
URL="https://github.com/pmmp/PocketMine-MP/releases/download/$VERSION/PocketMine-MP.phar" | |
if wget -q "$URL" > /dev/null; | |
then | |
echo "Version changed to $VERSION" | |
else | |
echo "Version not found!" | |
echo "Reverting backup" | |
mv Pocketmine-MP.phar.old Pocketmine-MP.phar 2> /dev/null | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment