param([switch]$DownloadOnly, [string]$Destination) $ErrorActionPreference='Stop' if ([Environment]::OSVersion.Platform -ne 'Win32NT' -or ($env:PROCESSOR_ARCHITECTURE -ne 'AMD64' -and $env:PROCESSOR_ARCHITEW6432 -ne 'AMD64')) { throw 'This package requires Windows x64' } [Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $d=Join-Path ([IO.Path]::GetTempPath()) ('tds-'+[guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $d | Out-Null try { $f=Join-Path $d 'Team-DevSpace-0.2.2-windows-x64-setup.exe' Write-Host 'Downloading Team DevSpace 0.2.2 (Windows x64)...' Invoke-WebRequest -UseBasicParsing -Uri 'https://downloads.568920429.xyz/releases/0.2.2/Team-DevSpace-0.2.2-windows-x64-setup.exe' -OutFile $f if ((Get-Item -LiteralPath $f).Length -ne 144437590 -or (Get-FileHash -LiteralPath $f -Algorithm SHA256).Hash -ne '79ebdfb3b5b57fa25692a431ffa2f5d6402b43d7ff6f73db67fe8d37dc9d64a3') { throw 'Package verification failed; nothing was installed' } if ($DownloadOnly) { if (-not $Destination) { $Destination=Join-Path $HOME 'Downloads' } New-Item -ItemType Directory -Path $Destination -Force | Out-Null $saved=Join-Path $Destination 'Team-DevSpace-0.2.2-windows-x64-setup.exe' Copy-Item -LiteralPath $f -Destination $saved Write-Output $saved } else { $p=Start-Process -FilePath $f -Wait -PassThru if ($p.ExitCode -notin @(0,3010)) { throw ('Installer failed: '+$p.ExitCode) } Write-Host 'Software installation finished. Enter or change Access Key inside Team DevSpace.' } } finally { Remove-Item -LiteralPath $d -Recurse -Force }