Skip to content

Commit

Permalink
Fix auto update (#50)
Browse files Browse the repository at this point in the history
* Fix auto update

* Fix typo
  • Loading branch information
james090500 authored Dec 10, 2023
1 parent 1690b84 commit 467d8b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions egg-geyser-m-c.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"user_editable": true,
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/",
"field_type": "text"
},
{
"name": "Geyser Auto Update",
"description": "Should Geyser attempt an auto-update on startup.",
"env_variable": "AUTO_UPDATE",
"default_value": "1",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean|numeric",
"field_type": "text"
}
]
}
4 changes: 2 additions & 2 deletions pterodactyl-geyser/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'`
if [ "${AUTO_UPDATE}" == "1" ]; then
echo "Checking for updates..."

LATEST_HASH=`curl -s https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/${UPDATE_BRANCH}/lastSuccessfulBuild/api/xml?xpath=//lastBuiltRevision/SHA1 | sed 's/.*>\(.*\)<.*/\1/'`
LATEST_HASH=`curl -L https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest | jq -r .downloads.standalone.sha256`
CURRENT_HASH=`cat .currenthash 2>/dev/null`

if [ "$LATEST_HASH" != "$CURRENT_HASH" ]; then
echo "Update available!"
echo "Updating from '$CURRENT_HASH' -> '$LATEST_HASH'"
curl -s -o ${SERVER_JARFILE} https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/${UPDATE_BRANCH}/lastSuccessfulBuild/artifact/bootstrap/standalone/build/libs/Geyser-Standalone.jar
curl -s -o ${SERVER_JARFILE} https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/standalone

echo "$LATEST_HASH" > ".currenthash"
echo "Updated!"
Expand Down

0 comments on commit 467d8b9

Please sign in to comment.