Files
anonymisation/scripts/build_windows_cli_installer_only.ps1
Domi31tls 26f0cdfd68 feat(cli): add dedicated Inno Setup installer for the Windows CLI
Installateur Inno Setup séparé de la GUI (validé GO par Qwen), pour tests
internes et intégration de la brique CLI dans un autre logiciel.

- installer/Anonymisation-CLI.iss : AppId distinct de la GUI
  (B2F4A7C1-…), PrivilegesRequired=lowest, DefaultDirName
  {localappdata}\Programs\Anonymisation-CLI, source dist\Anonymisation-CLI.exe.
  Clés registre HKCU stables (InstallPath/ExePath/Version) + App Paths HKCU
  pour résolution tierce, supprimées à la désinstallation (uninsdeletekey).
  Pas de PATH système, pas de raccourci bureau. GUI .iss non modifiée.
- installer/Anonymisation-CLI-README.txt : usage, codes retour, lookup registre.
- scripts/build_windows_cli_installer_only.ps1 : build ISCC dédié,
  sortie release\Anonymisation-CLI-Setup.exe + SHA-256.
- docs/build-windows-oneclick.md : section « Installateur CLI dédié ».

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 16:44:58 +02:00

68 lines
2.4 KiB
PowerShell

# Build de l'installateur Inno Setup DÉDIÉ au CLI (distinct de la GUI).
# Produit release\Anonymisation-CLI-Setup.exe à partir de dist\Anonymisation-CLI.exe.
# Calcule le SHA-256. Ne touche pas au build/installateur GUI.
param(
[string]$AppVersion = (Get-Date -Format "yyyy.MM.dd.HHmm")
)
$ErrorActionPreference = "Stop"
function Resolve-InnoCompiler {
$command = Get-Command ISCC.exe -ErrorAction SilentlyContinue
if ($command) {
return $command.Source
}
$candidates = @()
if (${env:ProgramFiles(x86)}) {
$candidates += (Join-Path ${env:ProgramFiles(x86)} "Inno Setup 6\ISCC.exe")
}
if ($env:ProgramFiles) {
$candidates += (Join-Path $env:ProgramFiles "Inno Setup 6\ISCC.exe")
}
if ($env:LOCALAPPDATA) {
$candidates += (Join-Path $env:LOCALAPPDATA "Programs\Inno Setup 6\ISCC.exe")
$candidates += (Join-Path $env:LOCALAPPDATA "Inno Setup 6\ISCC.exe")
}
foreach ($candidate in $candidates) {
if ($candidate -and (Test-Path $candidate)) {
return $candidate
}
}
throw "ISCC.exe introuvable. Installer Inno Setup 6 puis relancer."
}
function Require-Path {
param(
[string]$PathValue,
[string]$Label
)
if (-not (Test-Path $PathValue)) {
throw "$Label introuvable: $PathValue"
}
}
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ProjectRoot = (Resolve-Path (Join-Path $ScriptDir "..")).Path
$InstallerScriptPath = Join-Path $ProjectRoot "installer\Anonymisation-CLI.iss"
$PackageExePath = Join-Path $ProjectRoot "dist\Anonymisation-CLI.exe"
$InstallerPath = Join-Path $ProjectRoot "release\Anonymisation-CLI-Setup.exe"
Require-Path -PathValue $InstallerScriptPath -Label "Script Inno Setup CLI"
Require-Path -PathValue $PackageExePath -Label "Executable CLI (dist\Anonymisation-CLI.exe)"
$innoCompiler = Resolve-InnoCompiler
Write-Host "Inno Setup Compiler : $innoCompiler"
& $innoCompiler "/DAppVersion=$AppVersion" $InstallerScriptPath
if ($LASTEXITCODE -ne 0) {
throw "Inno Setup a echoue avec le code $LASTEXITCODE."
}
Require-Path -PathValue $InstallerPath -Label "Installateur CLI Windows"
$installerSizeMb = [math]::Round((Get-Item $InstallerPath).Length / 1MB, 1)
$sha = (Get-FileHash -Algorithm SHA256 $InstallerPath).Hash
Set-Content -Path "$InstallerPath.sha256.txt" -Value $sha -Encoding ascii
Write-Host "Installateur CLI pret : $InstallerPath ($installerSizeMb MB)"
Write-Host "SHA-256 : $sha"