publish install.ps1

This commit is contained in:
brockdarnold 2026-06-15 00:11:27 +00:00
parent 68709c0331
commit 83c049f829

View file

@ -62,20 +62,27 @@ if (-not (Ensure-Tool python "Python.Python.3.12")) {
} }
$haveGit = Ensure-Tool git "Git.Git" $haveGit = Ensure-Tool git "Git.Git"
$env:GIT_TERMINAL_PROMPT = "0" # fail fast instead of interactive y/n prompts
if ($haveGit) { if ($haveGit) {
if (-not (Test-Path (Join-Path $dir ".git"))) { # Preserve local config across a clean re-clone.
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null } $cfgTmp = $null
git -C $dir init -q $cfgPath = Join-Path $dir "config.ini"
if (Test-Path $cfgPath) { $cfgTmp = Join-Path $env:TEMP "eve-config.bak"; Copy-Item $cfgPath $cfgTmp -Force }
# In-place git updates can lock .git pack files (Defender / EVE patcher scanning the
# drive) -> "Unlink of file ... failed". Avoid it: re-clone fresh into an empty dir.
if (Test-Path $dir) {
Get-Process git -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue
} }
if (-not (git -C $dir remote)) { git -C $dir remote add origin $repo } else { git -C $dir remote set-url origin $repo } if (Test-Path $dir) {
git -C $dir fetch -q origin Write-Warning "old folder is locked (AV/EVE scan?) - using zip instead."
if ($LASTEXITCODE -eq 0) { Ping("git folder locked on **$env:COMPUTERNAME** - zip fallback")
git -C $dir checkout -q -B main origin/main
git -C $dir reset --hard -q origin/main # config.ini gitignored -> untouched
} else {
Write-Warning "git fetch failed - using zip download instead."
Download-Zip Download-Zip
} else {
git clone --depth 1 $repo $dir
if ($LASTEXITCODE -ne 0) { Write-Warning "clone failed - using zip."; Download-Zip }
} }
if ($cfgTmp -and (Test-Path $cfgTmp)) { Copy-Item $cfgTmp (Join-Path $dir "config.ini") -Force }
} else { } else {
Write-Host "Git not available - installing without it (zip mode)." Write-Host "Git not available - installing without it (zip mode)."
Download-Zip Download-Zip