- template/ : build Packer du template Windows 11 (ex /data/Installer/MyTemplate) - deploy/ : OpenTofu + playbooks Ansible (ex /data/Tofu) - bin/Deploy : menu de déploiement (lien depuis /usr/local/bin/Deploy) - jeton API Proxmox sorti des playbooks vers deploy/proxmox-secret.yml (hors git) - README.md : documentation de la structure et du mode opératoire - Ameliorations.md : recommandations pour fiabiliser les mesures - tests/ (dépôt beWeapon-LT) et archives/ exclus Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
99 lines
3.9 KiB
PowerShell
99 lines
3.9 KiB
PowerShell
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
|
|
function Test-CommandExists {
|
|
param ($Command)
|
|
return [bool](Get-Command $Command -ErrorAction SilentlyContinue)
|
|
}
|
|
|
|
function Write-Log {
|
|
param ([string]$Message)
|
|
"$Message" | Out-File -FilePath "C:\install.log" -Append -Encoding utf8
|
|
}
|
|
|
|
# Logs initiaux
|
|
Write-Log "=== Configuration et installation des prerequis Appium ==="
|
|
Write-Host "=== Configuration et installation des prerequis Appium ===" -ForegroundColor Cyan
|
|
|
|
# 1. Desactivation de l'alias Microsoft Store pour Python (Session courante)
|
|
$aliasPath = "$env:LOCALAPPDATA\Microsoft\WindowsApps\python.exe"
|
|
if (Test-Path $aliasPath) {
|
|
Remove-Item $aliasPath -Force -ErrorAction SilentlyContinue
|
|
Write-Log "Alias Microsoft Store pour Python supprime dans $aliasPath"
|
|
}
|
|
|
|
# 2. Installation de Node.js via winget
|
|
if (-not (Test-CommandExists "node")) {
|
|
Write-Host "Installation de Node.js..." -ForegroundColor Yellow
|
|
Write-Log "Node.js non detecte. Lancement de l'installation via winget..."
|
|
|
|
winget install --id OpenJS.NodeJS -e --source winget --accept-source-agreements --accept-package-agreements
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Log "Installation de Node.js reussie via winget."
|
|
} else {
|
|
Write-Log "Erreur lors de l'installation de Node.js (Code sortie : $LASTEXITCODE)."
|
|
}
|
|
} else {
|
|
$nodeVersion = node -v 2>$null
|
|
Write-Host "Node.js est deja installe : $nodeVersion" -ForegroundColor Green
|
|
Write-Log "Node.js deja installe ($nodeVersion)."
|
|
}
|
|
|
|
# 3. Installation de Python via winget
|
|
if (-not (Test-CommandExists "python")) {
|
|
Write-Host "Installation de Python 3.12..." -ForegroundColor Yellow
|
|
Write-Log "Python non detecte. Lancement de l'installation de Python 3.12 via winget..."
|
|
|
|
winget install --id Python.Python.3.12 -e --source winget --accept-source-agreements --accept-package-agreements
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Log "Installation de Python 3.12 reussie via winget."
|
|
} else {
|
|
Write-Log "Erreur lors de l'installation de Python 3.12 (Code sortie : $LASTEXITCODE)."
|
|
}
|
|
} else {
|
|
$pythonVersion = python --version 2>$null
|
|
Write-Host "Python est deja installe : $pythonVersion" -ForegroundColor Green
|
|
Write-Log "Python deja installe ($pythonVersion)."
|
|
}
|
|
|
|
# 4. Rafraîchissement dynamique du PATH dans la session
|
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
|
Write-Log "Variables d'environnement PATH rafraîchies pour la session."
|
|
|
|
# 5. Installation d'Appium via NPM
|
|
if (Test-CommandExists "npm") {
|
|
Write-Host "Installation / Mise a jour d'Appium via npm..." -ForegroundColor Yellow
|
|
Write-Log "Lancement de l'installation d'Appium via npm..."
|
|
|
|
npm install -g --allow-scripts=appium appium
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Appium configure avec succes." -ForegroundColor Green
|
|
Write-Log "Appium installe/mis a jour avec succes via npm."
|
|
} else {
|
|
Write-Log "Erreur lors de l'installation d'Appium via npm (Code sortie : $LASTEXITCODE)."
|
|
}
|
|
} else {
|
|
Write-Error "NPM introuvable. Redemarrez le terminal."
|
|
Write-Log "ERREUR : NPM introuvable. Impossible d'installer Appium."
|
|
exit 1
|
|
}
|
|
|
|
# Recuperation des versions finales pour le rapport
|
|
$finalNode = if (Test-CommandExists 'node') { node -v 2>$null } else { "Non disponible" }
|
|
$finalPython = if (Test-CommandExists 'python') { python --version 2>$null } else { "Non disponible" }
|
|
$finalAppium = if (Test-CommandExists 'appium') { appium -v 2>$null } else { "Non disponible" }
|
|
|
|
Write-Host "`n=== Resume des verifications ===" -ForegroundColor Cyan
|
|
Write-Host "Node.js : $finalNode"
|
|
Write-Host "Python : $finalPython"
|
|
Write-Host "Appium : $finalAppium"
|
|
|
|
# Journalisation du resume
|
|
Write-Log "=== Resume des installations ==="
|
|
Write-Log "Node.js : $finalNode"
|
|
Write-Log "Python : $finalPython"
|
|
Write-Log "Appium : $finalAppium"
|
|
Write-Log "Fin du script."
|