added downloader self check
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -18,8 +18,18 @@ cd "$HYTALE_DIR"
|
|||||||
log "Starting update check..."
|
log "Starting update check..."
|
||||||
|
|
||||||
# Run the updater to check for and download updates
|
# Run the updater to check for and download updates
|
||||||
# The updater downloads files like "2026-01-17-abcdef.zip"
|
# The updater downloads files like "2026.01.17-abcdef.zip"
|
||||||
./hytale-downloader-linux-amd64 2>&1 | tee -a "$LOG_FILE"
|
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)
|
# 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)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user