Files
agent-manager/install.ps1
T
bruno 50f515e406
release / release (push) Successful in 13m14s
release / macos (push) Canceled after 0s
fix: installateur Windows — accepter l'entree am-windows-x86_64.exe dans l'archive de release + i18n lang-aware pour am ai
- install.ps1 ne trouvait que 'am.exe' dans le zip : les archives (CI et
  manuelles) utilisent le nom plateforme 'am-windows-x86_64.exe' -> repli
  systematique sur cargo install au lieu du binaire precompile
- Le script accepte desormais les deux noms (copie vers am.exe) ; chemin
  du message cargo install corrige (.cargo\bin\am.exe au lieu de binam)
- i18n : am ai utilisait tr()/tr_fmt() globaux (flaky selon le process) —
  passage a tr_in/tr_fmt_in(app.lang()) + helper tr_fmt_in ajoute a i18n.rs
- Archive v1.0.6 : les deux entrees (am.exe + am-windows-x86_64.exe) pour
  la compatibilite maximale (installateurs et self-update)
- Tests ai_test insensibles a la locale (FR/EN)
- v1.0.6 ; ROADMAP maintenance note ajoutee
2026-08-20 12:45:10 -04:00

85 lines
3.9 KiB
PowerShell

# agent-manager (am) — installateur Windows (PowerShell 5.1+)
#
# One-liner :
# powershell -ExecutionPolicy Bypass -Command "irm https://git.dracodev.net/Projets/agent-manager/raw/branch/main/install.ps1 | iex"
#
# Télécharge le binaire de la dernière release Gitea ; à défaut, compile via
# cargo install --git. Relancez le script pour mettre à jour.
param(
[string]$BaseUrl = "https://git.dracodev.net/Projets/agent-manager",
[string]$ApiUrl = "https://git.dracodev.net/api/v1/repos/Projets/agent-manager",
[string]$InstallDir = ""
)
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
# PowerShell 5.1 : forcer TLS 1.2 pour les serveurs modernes
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {}
function Fail([string]$msg) { Write-Host "erreur: $msg" -ForegroundColor Red; exit 1 }
function Install-FromSource {
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
Fail "pas de binaire precompile et cargo est absent - installez Rust (https://rustup.rs) puis relancez"
}
Write-Host "Installation depuis les sources (cargo install --git $BaseUrl.git) ..."
cargo install --git "$BaseUrl.git" --locked
if ($LASTEXITCODE -ne 0) { Fail "cargo install a echoue" }
$bin = Join-Path $env:USERPROFILE ".cargo\bin\am.exe"
Write-Host ""
Write-Host "OK - am est installe dans $bin"
Write-Host "Essayez : am list | am doctor (mise a jour : relancez ce script)"
exit 0
}
$arch = if ($env:PROCESSOR_ARCHITECTURE -match "ARM") { "arm64" } else { "x86_64" }
$binDir = if ($InstallDir) { $InstallDir } else { Join-Path $env:LOCALAPPDATA "agent-manager\bin" }
if ($arch -eq "x86_64") {
$ok = $false
try {
$release = Invoke-RestMethod -Uri "$ApiUrl/releases/latest" -UseBasicParsing -TimeoutSec 20
$tag = $release.tag_name
$asset = "am-windows-x86_64.zip"
$url = "$BaseUrl/releases/download/$tag/$asset"
$tmp = Join-Path $env:TEMP "am-$tag.zip"
Write-Host "Telechargement de $url ..."
Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing -TimeoutSec 300
$tmpDir = Join-Path $env:TEMP "am-$tag"
Remove-Item $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
Expand-Archive -Path $tmp -DestinationPath $tmpDir -Force
# L'entrée de l'archive varie selon le pipeline : « am.exe » ou
# « am-windows-x86_64.exe » (nom de l'asset). Accepter les deux.
$exe = Join-Path $tmpDir "am.exe"
if (-not (Test-Path $exe)) { $exe = Join-Path $tmpDir "am-windows-x86_64.exe" }
if (Test-Path $exe) {
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
Copy-Item $exe (Join-Path $binDir "am.exe") -Force
Remove-Item $tmp -Force -ErrorAction SilentlyContinue
Remove-Item $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
$ok = $true
} else { throw "am.exe absent de l'archive" }
} catch {
Write-Host "Binaire precompile indisponible ($($_.Exception.Message)) - installation depuis les sources ..."
}
if (-not $ok) { Install-FromSource }
} else {
Write-Host "Architecture $arch : pas de binaire precompile - installation depuis les sources ..."
Install-FromSource
}
# Ajout au PATH utilisateur (permanent) uniquement pour le dossier par defaut
if (-not $InstallDir) {
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$binDir*") {
[Environment]::SetEnvironmentVariable("Path", "$binDir;$userPath", "User")
Write-Host "Ajout de $binDir au PATH utilisateur (rouvrez votre terminal pour en profiter)"
}
}
$env:Path = "$binDir;$env:Path"
& (Join-Path $binDir "am.exe") --version
Write-Host ""
Write-Host "OK - 'am' est installe. Essayez :"
Write-Host " am list"
Write-Host " am doctor"
Write-Host "Mise a jour : relancez ce script."