fix(codex): fix Windows download URLs — binary is .exe not .zip

GitHub releases use codex-x86_64-pc-windows-msvc.exe (not .zip).
Fixed both install and update PS1 scripts.
Also added patched settingsSchema.js to gemini releases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 08:01:38 +00:00
parent 9b6d0ebeb7
commit 9f26c53ece
3 changed files with 2430 additions and 51 deletions

View File

@@ -96,26 +96,26 @@ if ($currentVersion -eq $latestVersion) {
} }
# Determine architecture # Determine architecture
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" } $arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "aarch64" }
$binarySuffix = "$arch-pc-windows-msvc" $binarySuffix = "$arch-pc-windows-msvc"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.zip" $downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.exe"
Write-Host " Downloading: codex-$binarySuffix.zip" -ForegroundColor Cyan Write-Host " Downloading: codex-$binarySuffix.exe" -ForegroundColor Cyan
$tempDir = Join-Path $env:TEMP "codex-install-$(Get-Random)" $tempDir = Join-Path $env:TEMP "codex-install-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
$zipFile = Join-Path $tempDir "codex.zip" $exeFile = Join-Path $tempDir "codex.exe"
try { try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFile -UseBasicParsing Invoke-WebRequest -Uri $downloadUrl -OutFile $exeFile -UseBasicParsing
} catch { } catch {
Write-Host " Download failed: $_" -ForegroundColor Red Write-Host " Direct exe download failed, trying zip..." -ForegroundColor Yellow
# Try tar.gz fallback $zipUrl = "$downloadUrl.zip"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.tar.gz" $zipFile = Join-Path $tempDir "codex.zip"
Write-Host " Trying tar.gz: $downloadUrl" -ForegroundColor Yellow
$tgzFile = Join-Path $tempDir "codex.tar.gz"
try { try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tgzFile -UseBasicParsing Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile -UseBasicParsing
tar -xzf $tgzFile -C $tempDir Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
$found = Get-ChildItem -Path $tempDir -Recurse -Filter "codex*.exe" | Where-Object { $_.Name -notlike "*setup*" -and $_.Name -notlike "*proxy*" -and $_.Name -notlike "*runner*" } | Select-Object -First 1
if ($found) { Copy-Item $found.FullName $exeFile -Force }
} catch { } catch {
Write-Host " Download failed. Check https://github.com/openai/codex/releases" -ForegroundColor Red Write-Host " Download failed. Check https://github.com/openai/codex/releases" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
@@ -123,22 +123,8 @@ if ($currentVersion -eq $latestVersion) {
} }
} }
# Extract zip if downloaded if (-not (Test-Path $exeFile)) {
if (Test-Path $zipFile) { Write-Host " Binary not found after download" -ForegroundColor Red
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
}
# Find codex.exe
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex.exe" | Select-Object -First 1
if (-not $codexExe) {
# Try codex without extension
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex" | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1
}
if (-not $codexExe) {
Write-Host " codex binary not found in archive" -ForegroundColor Red
Write-Host " Contents:" -ForegroundColor Yellow
Get-ChildItem -Path $tempDir -Recurse | ForEach-Object { Write-Host " $($_.FullName)" }
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1 exit 1
} }
@@ -151,7 +137,7 @@ if ($currentVersion -eq $latestVersion) {
# Kill running codex processes # Kill running codex processes
Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force
Copy-Item -Path $codexExe.FullName -Destination $destPath -Force Copy-Item -Path $exeFile -Destination $destPath -Force
Write-Host " Installed: $destPath" -ForegroundColor Green Write-Host " Installed: $destPath" -ForegroundColor Green
# Add to PATH if not already there # Add to PATH if not already there

View File

@@ -41,24 +41,26 @@ if ($oldVer -eq $latestVer) {
} else { } else {
# ---- Download binary ---- # ---- Download binary ----
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" } $arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "aarch64" }
$binarySuffix = "$arch-pc-windows-msvc" $binarySuffix = "$arch-pc-windows-msvc"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.zip" $downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.exe"
Write-Host " Downloading codex-$binarySuffix..." -ForegroundColor Cyan Write-Host " Downloading codex-$binarySuffix.exe..." -ForegroundColor Cyan
$tempDir = Join-Path $env:TEMP "codex-update-$(Get-Random)" $tempDir = Join-Path $env:TEMP "codex-update-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
$zipFile = Join-Path $tempDir "codex.zip" $exeFile = Join-Path $tempDir "codex.exe"
try { try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFile -UseBasicParsing Invoke-WebRequest -Uri $downloadUrl -OutFile $exeFile -UseBasicParsing
} catch { } catch {
# Try tar.gz fallback Write-Host " Direct exe download failed, trying zip..." -ForegroundColor Yellow
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.tar.gz" $zipUrl = "$downloadUrl.zip"
$tgzFile = Join-Path $tempDir "codex.tar.gz" $zipFile = Join-Path $tempDir "codex.zip"
try { try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tgzFile -UseBasicParsing Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile -UseBasicParsing
tar -xzf $tgzFile -C $tempDir Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
$found = Get-ChildItem -Path $tempDir -Recurse -Filter "codex*.exe" | Where-Object { $_.Name -notlike "*setup*" -and $_.Name -notlike "*proxy*" -and $_.Name -notlike "*runner*" } | Select-Object -First 1
if ($found) { Copy-Item $found.FullName $exeFile -Force }
} catch { } catch {
Write-Host " Download failed." -ForegroundColor Red Write-Host " Download failed." -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
@@ -66,17 +68,8 @@ if ($oldVer -eq $latestVer) {
} }
} }
if (Test-Path $zipFile) { if (-not (Test-Path $exeFile)) {
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force Write-Host " Binary not found after download" -ForegroundColor Red
}
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex.exe" | Select-Object -First 1
if (-not $codexExe) {
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex" | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1
}
if (-not $codexExe) {
Write-Host " Binary not found in archive" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1 exit 1
} }
@@ -85,7 +78,7 @@ if ($oldVer -eq $latestVer) {
$installDir = "$env:LOCALAPPDATA\Programs\codex" $installDir = "$env:LOCALAPPDATA\Programs\codex"
New-Item -ItemType Directory -Force -Path $installDir | Out-Null New-Item -ItemType Directory -Force -Path $installDir | Out-Null
Copy-Item -Path $codexExe.FullName -Destination "$installDir\codex.exe" -Force Copy-Item -Path $exeFile -Destination "$installDir\codex.exe" -Force
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User") $userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installDir*") { if ($userPath -notlike "*$installDir*") {

File diff suppressed because it is too large Load Diff