# Sagwan receiver installer for Windows. Run it again to update. # # irm https://sagwan.yhisoft.com/install.ps1 | iex # # What it does # 1. Installs uv (Python tool manager) if missing: winget, or https://astral.sh/uv when winget is absent. # 2. Downloads the receiver package and the setup script from https://sagwan.yhisoft.com/dl/ and checks their SHA-256. # 3. Runs the setup script: installs the `sagwan` command, registers a logon task and firewall rules # for private networks only (one UAC prompt). # This file is ASCII only on purpose: it is piped through Invoke-Expression, where the encoding is not # guaranteed. The setup script it downloads is a UTF-8 file and prints Korean. & { $ErrorActionPreference = "Stop" $base = if ($env:SAGWAN_BASE_URL) { $env:SAGWAN_BASE_URL } else { "https://sagwan.yhisoft.com" } $wheel = "sagwan_receiver-0.2.0-py3-none-any.whl" $wheelSha = "4697f2e656502fcf7fec92a1ea214b7b287adf27a3475efd74623ae0a9bbed21" $setup = "install-windows.ps1" $setupSha = "4f6c5aa0c4a0c5370172e03916a5b094f1e7f9b4a7c1bdec7415dac2e696aba9" try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } catch {} $dir = Join-Path $env:LOCALAPPDATA "Sagwan\installer" New-Item -ItemType Directory -Force -Path $dir | Out-Null if (-not (Get-Command uv -ErrorAction SilentlyContinue)) { Write-Host "[sagwan] uv not found. Installing uv ..." if (Get-Command winget -ErrorAction SilentlyContinue) { winget install --id=astral-sh.uv -e --accept-source-agreements --accept-package-agreements } else { Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression } # Make uv visible in this window without reopening it. $env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User") + ";" + (Join-Path $env:USERPROFILE ".local\bin") if (-not (Get-Command uv -ErrorAction SilentlyContinue)) { throw "uv was installed but is not on PATH yet. Open a new PowerShell window and run the same command again." } } function Get-Checked([string]$name, [string]$sha) { $path = Join-Path $dir $name Write-Host "[sagwan] Downloading $name ..." Invoke-WebRequest -UseBasicParsing -Uri "$base/dl/$name" -OutFile $path $got = (Get-FileHash -Algorithm SHA256 -Path $path).Hash.ToLower() if ($got -ne $sha) { throw "Checksum mismatch for $name. Try again in a moment." } return $path } $wheelPath = Get-Checked $wheel $wheelSha $setupPath = Get-Checked $setup $setupSha & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $setupPath -Package $wheelPath if ($LASTEXITCODE -ne 0) { throw "Setup failed (exit code $LASTEXITCODE)." } }