Files
UltraGrid/data/update.ps1
2020-03-19 09:53:33 +01:00

24 lines
961 B
PowerShell

$ErrorActionPreference = "Stop"
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
cd $scriptDir
rm UltraGrid-nightly*
Invoke-WebRequest https://github.com/CESNET/UltraGrid/releases/download/nightly/UltraGrid-nightly-win64.zip -OutFile UltraGrid-nightly-win64.zip
if ($LastExitCode -ne 0) {
throw "Download failed"
}
$downloadExtractDir = "UltraGrid-nightly-latest-win64"
Expand-Archive -LiteralPath UltraGrid-nightly-win64.zip -DestinationPath $downloadExtractDir
$currentName = (Split-Path -Leaf Get-Location).Path
$downloadedName = (Get-ChildItem $downloadExtractDir).Name
if ($currentName -ne $downloadedName) {
Move-Item $downloadExtractDir/* ..
Write-Host "Downloaded ,$downloadedName removing $currentName."
Set-Location ../$downloadedName
Remove-Item -Recurse ../$currentName
} else {
Remove-Item -Recurse $downloadExtractDir
Remove-Item UltraGrid-nightly-win64.zip
}