Files
installations/Install-Codex-26.527.ps1

41 lines
1.4 KiB
PowerShell

$ErrorActionPreference = "Stop"
function Write-Step([string]$Message) {
Write-Host ((Get-Date).ToString("yyyy-MM-dd HH:mm:ss K") + " " + $Message)
}
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
$ZipPath = Join-Path $Root "Codex-26.527.7698.0-windows-x64-msix.zip"
$ExtractPath = Join-Path $Root "Codex-26.527.7698.0-windows-x64-msix"
$MsixPath = Join-Path $ExtractPath "OpenAI.Codex_26.527.7698.0_x64__2p2nqsd0c76g0.Msix"
$ExpectedHash = "eb038b71b9138d739e652d51adc15b3628cac34441727916b64e6e4699d259a4"
Write-Step "Checking Codex offline package at $ZipPath"
if (!(Test-Path $ZipPath)) {
throw "Missing package zip: $ZipPath"
}
if (Test-Path $ExtractPath) {
Write-Step "Removing previous extraction folder"
Remove-Item -Recurse -Force $ExtractPath
}
Write-Step "Extracting Codex package"
Expand-Archive -Path $ZipPath -DestinationPath $ExtractPath -Force
Write-Step "Verifying MSIX hash"
$ActualHash = (Get-FileHash -Algorithm SHA256 $MsixPath).Hash.ToLowerInvariant()
if ($ActualHash -ne $ExpectedHash) {
throw "Hash mismatch for $MsixPath. Expected $ExpectedHash but got $ActualHash"
}
Write-Step "Installing Codex 26.527.7698.0 from MSIX"
Add-AppxPackage -Path $MsixPath
Write-Step "Verifying installed Codex package"
Get-AppxPackage OpenAI.Codex |
Select-Object Name, PackageFullName, Version, InstallLocation |
Format-List
Write-Step "Codex installation command completed"