fix(bundle): Ollama v0.5.7 → v0.32.1 — gemma4:e4b pull 412 해소
- 번들 v0.5.7이 gemma4 요구(0.20+) 미달 → 온보딩 다운로드 412 실패 - 다운로드 스크립트: .ollama-version 스탬프로 runner 캐시 무효화 - cuda*/rocm* 재귀 가지치기 (신구 zip 레이아웃 모두 대응) + 1.5GB 경고 - darwin: v0.6+ tgz 자산 복귀 (bin/ollama·루트 바이너리 모두 지원)
This commit is contained in:
parent
b73317d584
commit
4fb1738160
4 changed files with 64 additions and 26 deletions
|
|
@ -7,17 +7,25 @@
|
|||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$OLLAMA_VERSION = if ($env:OLLAMA_VERSION) { $env:OLLAMA_VERSION } else { "v0.5.7" }
|
||||
$OLLAMA_VERSION = if ($env:OLLAMA_VERSION) { $env:OLLAMA_VERSION } else { "v0.32.1" }
|
||||
$OLLAMA_URL = "https://github.com/ollama/ollama/releases/download/$OLLAMA_VERSION/ollama-windows-amd64.zip"
|
||||
$DEST_DIR = Join-Path $PSScriptRoot "..\resources\ollama"
|
||||
$TEMP_ZIP = Join-Path $env:TEMP "ollama-$OLLAMA_VERSION-windows-amd64.zip"
|
||||
$TEMP_DIR = Join-Path $env:TEMP "ollama-extract"
|
||||
$VERSION_STAMP = Join-Path $DEST_DIR ".ollama-version"
|
||||
|
||||
Write-Host "=== Ollama $OLLAMA_VERSION (Windows amd64) ===" -ForegroundColor Cyan
|
||||
|
||||
# Version-aware cache: CI runner reuses the checkout dir, so an old bundle can
|
||||
# linger. Re-download whenever the stamped version differs from the wanted one.
|
||||
if (Test-Path (Join-Path $DEST_DIR "ollama.exe")) {
|
||||
Write-Host "Ollama already present: $DEST_DIR\ollama.exe" -ForegroundColor Green
|
||||
exit 0
|
||||
$stamped = if (Test-Path $VERSION_STAMP) { (Get-Content $VERSION_STAMP -Raw).Trim() } else { "" }
|
||||
if ($stamped -eq $OLLAMA_VERSION) {
|
||||
Write-Host "Ollama $OLLAMA_VERSION already present: $DEST_DIR\ollama.exe" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
Write-Host "Cached Ollama version '$stamped' != '$OLLAMA_VERSION' - re-downloading" -ForegroundColor Yellow
|
||||
Remove-Item -Recurse -Force $DEST_DIR
|
||||
}
|
||||
|
||||
if (Test-Path $TEMP_ZIP) { Remove-Item -Force $TEMP_ZIP }
|
||||
|
|
@ -65,23 +73,30 @@ Get-ChildItem -Path $TEMP_DIR -Force | ForEach-Object {
|
|||
Write-Host (" copied: {0}" -f $_.Name) -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Remove heavy GPU runners to stay below NSIS size limits
|
||||
$runnersDir = Join-Path $DEST_DIR "lib\ollama\runners"
|
||||
if (Test-Path $runnersDir) {
|
||||
Get-ChildItem $runnersDir -Directory | Where-Object { $_.Name -like "cuda*" -or $_.Name -like "rocm*" } | ForEach-Object {
|
||||
Remove-Item -Recurse -Force $_.FullName
|
||||
Write-Host (" pruned GPU runner: {0}" -f $_.Name) -ForegroundColor Yellow
|
||||
# Remove heavy GPU runtimes to stay below NSIS size limits.
|
||||
# Layout differs across versions (old: lib\ollama\runners\cuda*, new: lib\ollama\cuda_v12 etc.)
|
||||
# so prune ANY cuda*/rocm* directory recursively - version-agnostic.
|
||||
Get-ChildItem -Path $DEST_DIR -Directory -Recurse |
|
||||
Where-Object { $_.Name -like "cuda*" -or $_.Name -like "rocm*" } |
|
||||
ForEach-Object {
|
||||
if (Test-Path $_.FullName) {
|
||||
Remove-Item -Recurse -Force $_.FullName
|
||||
Write-Host (" pruned GPU runtime: {0}" -f $_.FullName.Substring($DEST_DIR.Length)) -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Item -Recurse -Force $TEMP_DIR -ErrorAction SilentlyContinue
|
||||
Remove-Item -Force $TEMP_ZIP -ErrorAction SilentlyContinue
|
||||
|
||||
if (Test-Path (Join-Path $DEST_DIR "ollama.exe")) {
|
||||
$ollamaSize = (Get-Item (Join-Path $DEST_DIR "ollama.exe")).Length
|
||||
$ollamaMB = [math]::Round($ollamaSize / 1MB, 1)
|
||||
Set-Content -Path $VERSION_STAMP -Value $OLLAMA_VERSION
|
||||
$totalSize = (Get-ChildItem $DEST_DIR -Recurse -File | Measure-Object -Property Length -Sum).Sum
|
||||
$totalMB = [math]::Round($totalSize / 1MB, 0)
|
||||
Write-Host ""
|
||||
Write-Host ("Ollama installed: {0} ({1} MB)" -f $DEST_DIR, $ollamaMB) -ForegroundColor Green
|
||||
Write-Host ("Ollama $OLLAMA_VERSION installed: {0} (pruned total {1} MB)" -f $DEST_DIR, $totalMB) -ForegroundColor Green
|
||||
if ($totalSize -gt 1500MB) {
|
||||
Write-Host "WARNING: pruned bundle exceeds 1.5GB - NSIS 2GB installer limit at risk" -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
Write-Host "ollama.exe not found after extraction. Inspect the zip layout." -ForegroundColor Red
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue