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"
$env:GIT_TERMINAL_PROMPT = "0" # fail fast instead of interactive y/n prompts
if ($haveGit) {
if (-not (Test-Path (Join-Path $dir ".git"))) {
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
git -C $dir init -q
# Preserve local config across a clean re-clone.
$cfgTmp = $null
$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 }
git -C $dir fetch -q origin
if ($LASTEXITCODE -eq 0) {
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."
if (Test-Path $dir) {
Write-Warning "old folder is locked (AV/EVE scan?) - using zip instead."
Ping("git folder locked on **$env:COMPUTERNAME** - zip fallback")
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 {
Write-Host "Git not available - installing without it (zip mode)."
Download-Zip