<# install.ps1 - first-time bootstrap for the Eve watchers (Goliath + Adam's PC). One-liner (PowerShell): irm https://git.armoredarmadillo.com/brockdarnold/eve-watcher/raw/branch/main/install.ps1 | iex Paste it ONCE. It auto-installs anything missing (Python, and Git if available), downloads the watchers to %USERPROFILE%\eve-watcher (via git if possible, else a plain zip - no git required), then runs update.py which installs deps + Tesseract, starts the watchers, auto-detects the ore-hold readout (no manual snip), and sets up logon + daily auto-update. Nothing to install or configure by hand. Safe to re-run anytime. Your gitignored config.ini is never touched. #> $ErrorActionPreference = "Stop" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $repo = "https://git.armoredarmadillo.com/brockdarnold/eve-watcher.git" $zipUrl = "https://git.armoredarmadillo.com/brockdarnold/eve-watcher/archive/main.zip" $dir = Join-Path $env:USERPROFILE "eve-watcher" $hook = "https://discord.com/api/webhooks/1515603432583598172/7g2A9Lfg1afbZGoxBENu9TpxSxE4zfpg16nRqE08qzyI3a0uttADL6wyJ2ERHRfsHlK9" function Ping($text) { try { Invoke-RestMethod -Uri $hook -Method Post -ContentType 'application/json' ` -Body (@{content = $text} | ConvertTo-Json) -UseBasicParsing | Out-Null } catch {} } Ping("🔧 Installer started on **$env:COMPUTERNAME** (user $env:USERNAME)") trap { Ping("❌ Installer FAILED on **$env:COMPUTERNAME**: $($_.Exception.Message)"); break } function Have($c) { [bool](Get-Command $c -ErrorAction SilentlyContinue) } function Refresh-Path { $m = [Environment]::GetEnvironmentVariable("Path", "Machine") $u = [Environment]::GetEnvironmentVariable("Path", "User") $env:Path = (@($m, $u) | Where-Object { $_ }) -join ';' } function Ensure-Tool($cmd, $wingetId) { if (Have $cmd) { return $true } if (Have winget) { Write-Host "Installing $cmd (one-time, may prompt UAC)..." try { winget install --id $wingetId -e --silent --accept-package-agreements --accept-source-agreements | Out-Null } catch {} Refresh-Path # so the just-installed tool is found in THIS session } return (Have $cmd) } function Download-Zip { Write-Host "Downloading watcher (no git needed)..." $tmp = Join-Path $env:TEMP "eve-watcher.zip" Invoke-WebRequest -Uri $zipUrl -OutFile $tmp -UseBasicParsing $ex = Join-Path $env:TEMP ("ew_" + [guid]::NewGuid().ToString("N")) Expand-Archive -Path $tmp -DestinationPath $ex -Force New-Item -ItemType Directory -Path $dir -Force | Out-Null Copy-Item -Path (Join-Path $ex "eve-watcher\*") -Destination $dir -Recurse -Force # archive has no config.ini Remove-Item $tmp, $ex -Recurse -Force -ErrorAction SilentlyContinue } # Pick up anything installed earlier in a now-stale session (e.g. git just installed # by hand but PATH not refreshed - exactly the "git not found after installing" case). Refresh-Path # Python is the runtime - required. Git is optional (nice for updates/edits). if (-not (Ensure-Tool python "Python.Python.3.12")) { throw "Python is required and couldn't be auto-installed. Get it from https://www.python.org (check 'Add to PATH'), then re-run." } $haveGit = Ensure-Tool git "Git.Git" 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 } 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." Download-Zip } } else { Write-Host "Git not available - installing without it (zip mode)." Download-Zip } if (-not (Test-Path (Join-Path $dir "update.py"))) { throw "update.py missing after install - aborting." } Set-Location $dir $py = (Get-Command python -ErrorAction SilentlyContinue) Ping("📦 Code synced on **$env:COMPUTERNAME**; python=$([bool]$py); running update.py...") python update.py Ping("✅ Installer finished on **$env:COMPUTERNAME** (update.py exit $LASTEXITCODE)") Write-Host "" Write-Host "Installed at $dir. Auto-start + daily auto-update are configured - nothing else to do." Write-Host "Have your in-game Ore Hold window open so it can auto-calibrate the live % reader."