# lamps.sh/install.ps1 — installs the `lamp` binary on Windows. # irm https://lamps.sh/install.ps1 | iex # # What it does, in order: download the release binary from GitHub, verify its sha256, # put it in ~\.lamps\bin, add that to the user PATH. Nothing else. $ErrorActionPreference = "Stop" $Repo = "synsema/lamp" $Base = "https://github.com/$Repo/releases/latest/download" $Home_ = if ($env:LAMPS_HOME) { $env:LAMPS_HOME } else { Join-Path $HOME ".lamps" } $BinDir = Join-Path $Home_ "bin" $Asset = "lamp-windows-x64.exe" $arch = $env:PROCESSOR_ARCHITECTURE if ($arch -ne "AMD64") { throw "lamp install: unsupported architecture: $arch" } New-Item -ItemType Directory -Force -Path $BinDir | Out-Null $tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("lamp-" + [System.Guid]::NewGuid().ToString("N")) New-Item -ItemType Directory -Force -Path $tmp | Out-Null try { Write-Host "downloading $Asset …" $exe = Join-Path $tmp "lamp.exe" $sum = Join-Path $tmp "lamp.sha256" Invoke-WebRequest -Uri "$Base/$Asset" -OutFile $exe -UseBasicParsing Invoke-WebRequest -Uri "$Base/$Asset.sha256" -OutFile $sum -UseBasicParsing $expected = ((Get-Content $sum -Raw) -split '\s+')[0].ToLower() $actual = (Get-FileHash $exe -Algorithm SHA256).Hash.ToLower() if ($expected -ne $actual) { throw "lamp install: sha256 mismatch: expected $expected, got $actual" } Unblock-File $exe $dest = Join-Path $BinDir "lamp.exe" Move-Item -Force $exe $dest Write-Host "installed $dest" $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if (-not (($userPath -split ";") -contains $BinDir)) { [Environment]::SetEnvironmentVariable("Path", "$userPath;$BinDir", "User") $env:Path = "$env:Path;$BinDir" Write-Host "added $BinDir to your user PATH (open a new terminal to pick it up)" } Write-Host "" Write-Host "next — nothing is pulled yet; every lamp is one pull away:" Write-Host " lamp pull git read-only git, from github.com/synsema/lamps" Write-Host " cd " Write-Host " lamp git log runs under stdout,env=LAMP_*,exec=git — nothing else" Write-Host " lamp list what is here, and whether agents get it" } finally { Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue }