20 lines
1.2 KiB
PowerShell
20 lines
1.2 KiB
PowerShell
# Preparation-only: the import body cannot execute in this revision.
|
|
throw 'REFUSED: CUST73 revision 3 has no distribution-creation authorization.'
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$DistroName = 'custodian-codex'
|
|
$Image = Join-Path $PSScriptRoot 'ubuntu-24.04.5-wsl-amd64.wsl'
|
|
$Expected = 'bb415d824822c4b878125729af451a5d18fb13d1cf5cbed9a7393ad64ac6039e'
|
|
$Store = Join-Path $env:LOCALAPPDATA 'Custodian\WSL\custodian-codex'
|
|
if ((Get-FileHash -Algorithm SHA256 -LiteralPath $Image).Hash.ToLower() -ne $Expected) {
|
|
throw 'Rootfs digest mismatch'
|
|
}
|
|
$Existing = (& wsl.exe --list --quiet) -replace "`0", ''
|
|
if ($LASTEXITCODE -ne 0) { throw 'WSL inventory unavailable' }
|
|
if ($Existing.Trim() -contains $DistroName) { throw 'Distribution already exists' }
|
|
if (Test-Path -LiteralPath $Store) { throw 'Destination already exists' }
|
|
# ACL/rootfs/signature/free-space checks in PROPOSAL.md must precede this body.
|
|
# --import does not copy the operator home; no existing distro is exported.
|
|
& wsl.exe --import $DistroName $Store $Image --version 2
|
|
if ($LASTEXITCODE -ne 0) { throw 'Import failed; retain evidence, do not unregister' }
|
|
# Do not start a guest, clone a repo, copy credentials or install Codex here.
|