publish install.ps1

This commit is contained in:
brockdarnold 2026-06-14 07:50:29 +00:00
parent d2db014bfd
commit bd1bf9dd55

View file

@ -4,60 +4,46 @@
One-liner (PowerShell): One-liner (PowerShell):
irm https://git.armoredarmadillo.com/brockdarnold/eve-watcher/raw/branch/main/install.ps1 | iex irm https://git.armoredarmadillo.com/brockdarnold/eve-watcher/raw/branch/main/install.ps1 | iex
Paste it ONCE and you're done forever: it puts the watcher repo in Paste it ONCE. It puts the watcher repo in %USERPROFILE%\eve-watcher, forces the
%USERPROFILE%\eve-watcher, runs update.py, and update.py registers a Windows working tree to match the latest code, and runs update.py - which installs deps +
Scheduled Task that auto-updates + restarts the watchers at every logon and Tesseract, starts the watchers, auto-detects the ore-hold readout (no manual snip),
once a day. You never have to install or update again. and registers logon + daily auto-update. You never have to install or update again.
Safe to re-run: if the folder already exists (even from the old non-git Safe to re-run anytime: it force-syncs to the latest code (reset --hard) and never
installer) it is converted into a git clone in place, keeping your config.ini touches your gitignored config.ini.
(webhook + OCR snip). config.ini is gitignored, so updates never touch it.
#> #>
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$repo = "https://git.armoredarmadillo.com/brockdarnold/eve-watcher.git" $repo = "https://git.armoredarmadillo.com/brockdarnold/eve-watcher.git"
$dir = Join-Path $env:USERPROFILE "eve-watcher" $dir = Join-Path $env:USERPROFILE "eve-watcher"
function Need($cmd, $hint) { function Need($cmd, $hint) {
if (-not (Get-Command $cmd -ErrorAction SilentlyContinue)) { if (-not (Get-Command $cmd -ErrorAction SilentlyContinue)) { throw "$cmd not found. $hint" }
Write-Warning "$cmd not found. $hint"; exit 1
}
}
function GitOk($desc) {
if ($LASTEXITCODE -ne 0) { Write-Warning "git failed: $desc"; exit 1 }
} }
function GitMust($desc) { if ($LASTEXITCODE -ne 0) { throw "git $desc failed (exit $LASTEXITCODE)" } }
Need git "Install it: winget install --id Git.Git -e (then re-run)" Need git "Install it: winget install --id Git.Git -e (then re-run)"
Need python "Install Python 3 from https://www.python.org (check 'Add to PATH'), then re-run." Need python "Install Python 3 from https://www.python.org (check 'Add to PATH'), then re-run."
if (Test-Path (Join-Path $dir ".git")) { # Make $dir a git clone of $repo whose working tree is FORCED to the latest commit.
Write-Host "eve-watcher already cloned at $dir - pulling latest." # init+fetch+reset is bulletproof: it can't fail on a non-empty folder (old installer)
git -C $dir pull --ff-only; GitOk "pull" # or on Windows CRLF/dirty-tree issues the way `git clone` / `git pull` can.
} if (-not (Test-Path (Join-Path $dir ".git"))) {
elseif (Test-Path $dir) { if (Test-Path $dir) { Write-Host "Converting existing folder to a git clone (keeping config.ini)..." }
# Folder exists but isn't a git repo (old baked installer). Convert it in place, else { Write-Host "Creating $dir ..."; New-Item -ItemType Directory -Path $dir -Force | Out-Null }
# force-replacing the old scripts with the repo versions; config.ini is gitignored git -C $dir init -q; GitMust "init"
# so it's left exactly as-is.
Write-Host "Existing install found at $dir - converting to a git clone (keeping config.ini)..."
git -C $dir init -q; GitOk "init"
if (-not (git -C $dir remote)) { git -C $dir remote add origin $repo }
else { git -C $dir remote set-url origin $repo }
GitOk "remote"
git -C $dir fetch -q origin; GitOk "fetch"
git -C $dir checkout -f -B main origin/main; GitOk "checkout"
}
else {
Write-Host "Cloning eve-watcher into $dir ..."
git clone $repo $dir; GitOk "clone"
} }
if (-not (git -C $dir remote)) { git -C $dir remote add origin $repo }
else { git -C $dir remote set-url origin $repo }
Write-Host "Syncing to latest code..."
git -C $dir fetch -q origin; GitMust "fetch"
git -C $dir checkout -q -B main origin/main; GitMust "checkout"
git -C $dir reset --hard -q origin/main; GitMust "reset" # config.ini is gitignored -> untouched
if (-not (Test-Path (Join-Path $dir "update.py"))) { if (-not (Test-Path (Join-Path $dir "update.py"))) { throw "update.py missing after sync - aborting." }
Write-Warning "update.py missing after setup - something went wrong. Aborting."; exit 1
}
Set-Location $dir Set-Location $dir
python update.py python update.py
Write-Host "" Write-Host ""
Write-Host "Installed at $dir." Write-Host "Installed at $dir. Auto-start + daily auto-update are configured - nothing else to do."
Write-Host "Auto-start at logon + daily auto-update are configured - nothing else to do." Write-Host "Make sure your in-game Ore Hold is open so it can auto-calibrate the live % reader."
Write-Host "One-time (per PC) for OCR hold alerts: cd $dir ; python eve_orehold_watcher.py --snip"