From 7e3d39cfc272e84e60404ce91d9803b5cc862b41 Mon Sep 17 00:00:00 2001 From: Tim Pilius Date: Mon, 17 Apr 2023 17:44:33 -0400 Subject: [PATCH] Adding a check to the update scripts so that they will skip downloading the latest version if the currently installed version is up to date --- scripts/update.ps1 | 16 +++++++++++++++- scripts/update.sh | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/update.ps1 b/scripts/update.ps1 index ae75b8d0..39d491a8 100644 --- a/scripts/update.ps1 +++ b/scripts/update.ps1 @@ -7,8 +7,22 @@ $versions = Invoke-RestMethod -Uri $versionApi # Finding latest asset $windowsAsset = $versions[0].assets | Where-Object { $_.name.Contains("win-x64")} +$latestVersion = $versions[0].name Write-Host "Found latest version : " -NoNewline -Write-Host -ForegroundColor Cyan $windowsAsset.name +Write-Host -ForegroundColor Cyan $latestVersion + +# Seeing if SteamPrefill is already installed and up to date +if(Test-Path "SteamPrefill.exe") +{ + $currentVersion = (.\SteamPrefill.exe --version) + $upToDate = $currentVersion -eq $latestVersion + + if($upToDate) + { + Write-Host "Already up to date !" -ForegroundColor Yellow + return + } +} # Downloading Write-Host -ForegroundColor Yellow "Downloading..." diff --git a/scripts/update.sh b/scripts/update.sh index 7bf8204f..a2deb703 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -33,6 +33,16 @@ if [ -z "${LATEST_TAG}" ]; then fi echo -e " Found latest version : ${Cyan} ${LATEST_TAG} ${NC}" +# Checking to see if SteamPrefill is already up to date +if [ ! -f /SteamPrefill ]; then + CURRENT_VERSION=$(./SteamPrefill --version) + + if [ "${CURRENT_VERSION}" == "v${LATEST_TAG}" ]; then + echo -e "${Yellow} Already up to date !${NC}" + exit + fi +fi + # Downloading latest version echo -e "${Yellow} Downloading... ${NC}" DOWNLOAD_URL="https://github.com/tpill90/steam-lancache-prefill/releases/download/v${LATEST_TAG}/SteamPrefill-${LATEST_TAG}-linux-x64.zip"