Skip to content

Commit

Permalink
Merge pull request #286 from /issues/276-UpdateScriptOnlyWhenNewer
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 committed Apr 17, 2023
2 parents 14c46be + 7e3d39c commit 3eb5a5b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
10 changes: 10 additions & 0 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3eb5a5b

Please sign in to comment.