diff --git a/hytale-update.sh b/hytale-update.sh index d8c1caa..48dcfba 100755 --- a/hytale-update.sh +++ b/hytale-update.sh @@ -18,8 +18,18 @@ cd "$HYTALE_DIR" log "Starting update check..." # Run the updater to check for and download updates -# The updater downloads files like "2026-01-17-abcdef.zip" -./hytale-downloader-linux-amd64 2>&1 | tee -a "$LOG_FILE" +# The updater downloads files like "2026.01.17-abcdef.zip" +DOWNLOADER_OUTPUT=$(./hytale-downloader-linux-amd64 2>&1 | tee -a "$LOG_FILE") + +# Check if the downloader itself needs an update +if echo "$DOWNLOADER_OUTPUT" | grep -q "A new version of hytale-downloader is available"; then + log "Downloading new version of hytale-downloader..." + curl -sL -o hytale-downloader.zip "https://downloader.hytale.com/hytale-downloader.zip" + unzip -o hytale-downloader.zip -d "$HYTALE_DIR" + chmod +x "$HYTALE_DIR/hytale-downloader-linux-amd64" + rm -f hytale-downloader.zip + log "Downloader updated successfully." +fi # Find the newest zip file (pattern: YYYY.MM.DD-*.zip) NEWEST_ZIP=$(ls -t [0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]-*.zip 2>/dev/null | head -n1)