Files
UltraGrid/data/Windows/update.ps1
Martin Pulec 876869ebae Windows/update.ps1: make it working again
Currently, it always downloads continuous (regardless if invoked from
continous or release channel). But currently it doesn't remove the old
release if the name doesn't match continuous (moreover if it would be
deleted, it is moved to -bkp, possibly overriding the previous version).
2023-08-10 16:08:36 +02:00

27 lines
1023 B
PowerShell

$ErrorActionPreference = "Stop"
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
cd $scriptDir
rm UltraGrid-continuous*
Invoke-WebRequest https://github.com/CESNET/UltraGrid/releases/download/continuous/UltraGrid-continuous-win64.zip -OutFile UltraGrid-continuous-win64.zip
$downloadExtractDir = "UltraGrid-continuous-latest-win64"
Expand-Archive -LiteralPath UltraGrid-continuous-win64.zip -DestinationPath $downloadExtractDir
$currentName = (Get-Location | Split-Path -Leaf)
$downloadedName = (Get-ChildItem $downloadExtractDir).Name
Move-Item $downloadExtractDir/* ../$downloadedName-new
Set-Location ..
if ($currentName -eq $downloadedName) {
if (Test-Path -Path $currentName-bkp) {
Remove-Item -Recurse $currentName-bkp
}
Move-Item $currentName $currentName-bkp
}
Move-Item $downloadedName-new $downloadedName
Set-Location $downloadedName
Write-Host "Updated UltraGrid in $downloadedName. You can delete $currentName-bkp if everything is OK."