$ErrorActionPreference = "Stop" $BaseUrl = "https://get.uprooted.sh" $TempDir = Join-Path $env:TEMP "UprootedInstaller" if (Test-Path $TempDir) { Remove-Item $TempDir -Recurse -Force } New-Item -ItemType Directory -Force -Path $TempDir | Out-Null Write-Host "" Write-Host " Uprooted" -ForegroundColor Cyan Write-Host " ========" -ForegroundColor DarkCyan Write-Host "" Write-Host " Fetching release info..." -ForegroundColor Gray $manifest = Invoke-RestMethod "$BaseUrl/releases/latest.json" $version = $manifest.version $dlUrl = $manifest.asset.url $expectedHash = $manifest.asset.sha256.ToLowerInvariant() Write-Host " Version $version" -ForegroundColor White $fileName = Split-Path $dlUrl -Leaf $installerPath = Join-Path $TempDir $fileName Write-Host " Downloading..." -ForegroundColor Gray Invoke-WebRequest $dlUrl -OutFile $installerPath -UseBasicParsing Write-Host " Verifying integrity..." -ForegroundColor Gray $actualHash = (Get-FileHash $installerPath -Algorithm SHA256).Hash.ToLowerInvariant() if ($actualHash -ne $expectedHash) { Remove-Item $TempDir -Recurse -Force throw "SHA256 mismatch — expected $expectedHash, got $actualHash" } Write-Host "" Write-Host " Verified. Launching Uprooted v$version..." -ForegroundColor Green Write-Host "" Start-Process -FilePath $installerPath