# PURE Donor installer for Windows: https://purepure.app/deltag # Usage (PowerShell): irm https://fleet.purepure.app/deltag/install.ps1 | iex # Without the browser lane (pages that need JavaScript; less disk and memory): # $env:PURE_DONOR_BROWSER=0; irm https://fleet.purepure.app/deltag/install.ps1 | iex # Everything goes in %LOCALAPPDATA%\PURE-Donor plus one start-up file; no # administrator rights are needed. One script block: nothing leaks into the # session, and a download cut short runs nothing. & { $ErrorActionPreference = "Stop" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $Master = if ($env:PURE_WORK_MASTER_URL) { $env:PURE_WORK_MASTER_URL } else { "https://fleet.purepure.app" } $HomeDir = if ($env:PURE_DONOR_HOME) { $env:PURE_DONOR_HOME } else { Join-Path $env:LOCALAPPDATA "PURE-Donor" } $UvVersion = "0.13.5" $Admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator) if ($Admin -and $env:PURE_DONOR_ALLOW_ADMIN -ne "1") { Write-Host "Luk dette vindue og åbn PowerShell igen som almindelig bruger (ikke 'Kør som administrator')." return } $Web = New-Object System.Net.WebClient try { [void]$Web.DownloadString("$Master/deltag/manifest.json") } catch { Write-Host "PURE Donor åbner snart. Se $Master/deltag"; return } if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { $Asset = "aarch64-pc-windows-msvc"; $Sum = "09f47edf90726084a70f9426f6e3ca4f46e9bf7cbf23b1716ec64d60b055fae3" } else { $Asset = "x86_64-pc-windows-msvc"; $Sum = "a38b8d1902b7cfbc76b423ba1bb456f623f42064cdc72628b6075b89afd1019a" } New-Item -ItemType Directory -Force -Path (Join-Path $HomeDir "bin"), (Join-Path $HomeDir "downloads") | Out-Null # WebClient writes no Mark-of-the-Web and handles any profile path. $Zip = Join-Path $HomeDir "downloads\uv.zip" Write-Host "==> Henter installationsværktøjet uv $UvVersion" $Web.DownloadFile("https://github.com/astral-sh/uv/releases/download/$UvVersion/uv-$Asset.zip", $Zip) if ((Get-FileHash -Algorithm SHA256 $Zip).Hash.ToLower() -ne $Sum) { Remove-Item $Zip -Force; throw "Værktøjet kunne ikke verificeres; intet er installeret" } Expand-Archive -Force $Zip (Join-Path $HomeDir "downloads\uv") Move-Item -Force (Join-Path $HomeDir "downloads\uv\uv.exe") (Join-Path $HomeDir "bin\uv.exe") Remove-Item -Recurse -Force $Zip, (Join-Path $HomeDir "downloads\uv") $Uv = Join-Path $HomeDir "bin\uv.exe" # Process environment for this install only; restored in `finally`, so the # PowerShell window is as it was. $Names = "UV_PYTHON_INSTALL_DIR", "UV_CACHE_DIR", "UV_MANAGED_PYTHON", "UV_NO_CONFIG", "PURE_DONOR_HOME", "PURE_WORK_MASTER_URL" $Saved = @{} foreach ($Name in $Names) { $Saved[$Name] = [Environment]::GetEnvironmentVariable($Name, "Process") } try { # Python, uv's cache and nothing else outside the donor folder (no registry entry). $env:UV_PYTHON_INSTALL_DIR = Join-Path $HomeDir "python" $env:UV_CACHE_DIR = Join-Path $HomeDir "cache" $env:UV_MANAGED_PYTHON = "1" $env:UV_NO_CONFIG = "1" Write-Host "==> Henter Python 3.12" & $Uv python install --quiet --no-bin --no-registry 3.12 if ($LASTEXITCODE -ne 0) { throw "Python kunne ikke installeres" } $Python = (& $Uv python find 3.12).Trim() Write-Host "==> Henter PURE Donor" $Web.DownloadFile("$Master/deltag/launcher.py", (Join-Path $HomeDir "launcher.py")) $env:PURE_DONOR_HOME = $HomeDir $env:PURE_WORK_MASTER_URL = $Master $Extra = @() if ($env:PURE_DONOR_BROWSER -eq "0") { $Extra += "--no-browser" } & $Python (Join-Path $HomeDir "launcher.py") install @Extra } finally { foreach ($Name in $Names) { [Environment]::SetEnvironmentVariable($Name, $Saved[$Name], "Process") } } }