feat(deploy): installeur Inno Setup pour déploiement professionnel
- Lea.iss : script Inno Setup 6 (enrollment 2 pages, licence, machine_id) - build_installer.sh : staging + ISCC (compatible Wine sur Linux) - uninstall_lea.ps1 : kill PID + cleanup + notif serveur - configure_embed.ps1 : Python 3.12 embedded optionnel - config_template.txt : modèle pour installation silencieuse - LICENSE.txt : CGU AI Act Art. 50 - README.md : doc build, signing, déploiement silencieux Paramètres d'installation silencieuse : Lea-Setup-v1.0.0.exe /VERYSILENT /CONFIG=enroll.txt /LOG=install.log Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
112
deploy/installer/configure_embed.ps1
Normal file
112
deploy/installer/configure_embed.ps1
Normal file
@@ -0,0 +1,112 @@
|
||||
# ============================================================
|
||||
# configure_embed.ps1 — Configure le runtime Python embedded
|
||||
# ------------------------------------------------------------
|
||||
#
|
||||
# Quand le composant 'pythonembed' est installe, on a :
|
||||
# <AppDir>\python-embed\ <-- runtime Python 3.12 embedded
|
||||
#
|
||||
# Ce script :
|
||||
# 1. Active l'import des packages (patch de python312._pth)
|
||||
# 2. Installe pip dans le runtime embedded
|
||||
# 3. Installe les dependances requirements_agent.txt
|
||||
# 4. Reecrit Lea.bat pour pointer sur python-embed\pythonw.exe
|
||||
#
|
||||
# Doit etre execute avec le CWD = <AppDir>
|
||||
# ============================================================
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$AppDir = Get-Location
|
||||
$EmbedDir = Join-Path $AppDir "python-embed"
|
||||
$PythonExe = Join-Path $EmbedDir "python.exe"
|
||||
|
||||
if (-not (Test-Path $PythonExe)) {
|
||||
Write-Host "Python embedded introuvable, abandon."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Configuration de Python embedded..."
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 1. Decommenter la ligne 'import site' dans python312._pth
|
||||
# (necessaire pour que pip puisse fonctionner)
|
||||
# ---------------------------------------------------------------
|
||||
$PthFile = Get-ChildItem -Path $EmbedDir -Filter "python*._pth" | Select-Object -First 1
|
||||
if ($PthFile) {
|
||||
$Content = Get-Content $PthFile.FullName
|
||||
$NewContent = $Content -replace '^#import site', 'import site'
|
||||
Set-Content -Path $PthFile.FullName -Value $NewContent
|
||||
Write-Host " python._pth patche (import site active)"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 2. Installer pip (bootstrap via get-pip.py)
|
||||
# ---------------------------------------------------------------
|
||||
$GetPip = Join-Path $env:TEMP "get-pip.py"
|
||||
Write-Host " Telechargement de get-pip.py..."
|
||||
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile $GetPip -UseBasicParsing
|
||||
|
||||
Write-Host " Installation de pip..."
|
||||
& $PythonExe $GetPip --no-warn-script-location
|
||||
Remove-Item $GetPip -Force
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 3. Installer les dependances
|
||||
# ---------------------------------------------------------------
|
||||
$Requirements = Join-Path $AppDir "requirements_agent.txt"
|
||||
if (Test-Path $Requirements) {
|
||||
Write-Host " Installation des dependances Python..."
|
||||
& $PythonExe -m pip install --no-warn-script-location -r $Requirements
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 4. Reecrire Lea.bat pour utiliser python-embed
|
||||
# ---------------------------------------------------------------
|
||||
$LeaBat = Join-Path $AppDir "Lea.bat"
|
||||
$NewLeaBat = @"
|
||||
@echo off
|
||||
chcp 65001 >nul 2>&1
|
||||
title Lea - Assistante IA
|
||||
cd /d "%~dp0"
|
||||
|
||||
if exist "lea_agent.lock" (
|
||||
for /f "usebackq tokens=* delims=" %%i in ("lea_agent.lock") do (
|
||||
taskkill /F /PID %%i >nul 2>&1
|
||||
)
|
||||
del /f /q "lea_agent.lock" >nul 2>&1
|
||||
timeout /t 2 >nul
|
||||
)
|
||||
|
||||
if exist "config.txt" (
|
||||
for /f "usebackq eol=# tokens=1,* delims==" %%a in ("config.txt") do (
|
||||
if not "%%a"=="" if not "%%b"=="" set "%%a=%%b"
|
||||
)
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Demarrage de Lea (runtime embedded)...
|
||||
echo.
|
||||
|
||||
start "" /b "%~dp0python-embed\pythonw.exe" run_agent_v1.py
|
||||
|
||||
timeout /t 3 >nul
|
||||
set "LEA_ALIVE=0"
|
||||
if exist "lea_agent.lock" (
|
||||
for /f "usebackq tokens=* delims=" %%i in ("lea_agent.lock") do (
|
||||
tasklist /FI "PID eq %%i" /NH 2>nul | findstr /I "pythonw" >nul && set "LEA_ALIVE=1"
|
||||
)
|
||||
)
|
||||
if "%LEA_ALIVE%"=="0" (
|
||||
echo.
|
||||
echo Lea n'a pas demarre correctement. Affichage des erreurs :
|
||||
echo.
|
||||
"%~dp0python-embed\python.exe" run_agent_v1.py
|
||||
pause
|
||||
)
|
||||
"@
|
||||
|
||||
Set-Content -Path $LeaBat -Value $NewLeaBat -Encoding ASCII
|
||||
Write-Host " Lea.bat reecrit pour runtime embedded"
|
||||
|
||||
Write-Host "Configuration terminee."
|
||||
exit 0
|
||||
Reference in New Issue
Block a user