geyser/entrypoint.sh
Merith-TK 84d6876b74
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 29s
adjust shit
2025-05-13 19:32:22 +00:00

37 lines
956 B
Bash

#!/bin/bash
set -euo pipefail
cd /data
JAR_PATH="geyser.jar"
TMP_JAR="geyser.jar.new"
DOWNLOAD_URL="https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/standalone"
echo "Downloading latest Geyser standalone JAR..."
wget -q -O "$TMP_JAR" "$DOWNLOAD_URL"
# Get new JAR hash
if [[ -f "$TMP_JAR" ]]; then
NEW_HASH=$(sha256sum "$TMP_JAR" | awk '{print $1}')
else
echo "Download failed or empty. Aborting."
exit 1
fi
# Install or update if necessary
if [[ ! -f "$JAR_PATH" ]]; then
echo "No existing Geyser JAR found. Installing..."
mv "$TMP_JAR" "$JAR_PATH"
else
OLD_HASH=$(sha256sum "$JAR_PATH" | awk '{print $1}')
if [[ "$NEW_HASH" != "$OLD_HASH" ]]; then
echo "New version detected. Updating Geyser..."
mv "$TMP_JAR" "$JAR_PATH"
else
echo "Geyser is already up to date."
rm -f "$TMP_JAR"
fi
fi
echo "Starting Geyser..."
exec java -jar "$JAR_PATH"