mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 18:40:09 +00:00
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).
27 lines
1023 B
PowerShell
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."
|
|
|