226af87379
Add Install-Games.ps1 script that downloads and launches official game installers marked with autoinstall=true in installers.json. The script: - Downloads installers from official Riot servers (not redistributed by FWS) - Supports silent installation via configurable arguments - Handles TLS 1.2 compatibility for older .NET stacks - Provides user feedback and error handling for download/launch failures - Note: Valorant installation requires manual confirmation due to Vanguard kernel driver and mandatory restart
53 lines
2.2 KiB
PowerShell
53 lines
2.2 KiB
PowerShell
<#
|
|
Install-Games.ps1 — telecharge et lance les installeurs OFFICIELS des jeux
|
|
marques autoinstall=true dans installers.json.
|
|
|
|
FWS ne redistribue AUCUN binaire Riot : chaque installeur est telecharge
|
|
depuis les serveurs de Riot. Riot change regulierement ses URLs -> en cas
|
|
d'echec, verifier/mettre a jour installers.json.
|
|
|
|
NB : l'installation de Valorant n'est PAS pleinement silencieuse (Vanguard
|
|
installe un driver noyau et impose un redemarrage) : ce script LANCE
|
|
l'installeur, l'utilisateur termine les eventuelles confirmations.
|
|
#>
|
|
$ErrorActionPreference = 'Continue'
|
|
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$cfg = Join-Path $here 'installers.json'
|
|
if (-not (Test-Path $cfg)) { Write-Warning "installers.json introuvable — aucun jeu installe."; return }
|
|
|
|
$installers = Get-Content $cfg -Raw | ConvertFrom-Json
|
|
$tmp = Join-Path $Env:TEMP 'fws-games'
|
|
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
|
|
|
|
# TLS 1.2 pour Invoke-WebRequest sur d'anciennes stacks .NET.
|
|
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch { }
|
|
|
|
$names = $installers.PSObject.Properties.Name | Where-Object { $_ -notlike '_*' }
|
|
foreach ($name in $names) {
|
|
$g = $installers.$name
|
|
if (-not $g.autoinstall) { Write-Host "$name : autoinstall=false, ignore."; continue }
|
|
if (-not $g.url) {
|
|
Write-Warning "$name : aucune URL dans installers.json — installe-le manuellement."
|
|
continue
|
|
}
|
|
|
|
$out = Join-Path $tmp $g.installer
|
|
try {
|
|
Write-Host "Telechargement de l'installeur $name ..."
|
|
Invoke-WebRequest -Uri $g.url -OutFile $out -UseBasicParsing
|
|
} catch {
|
|
Write-Warning "$name : telechargement echoue ($_). URL a verifier dans installers.json (Riot les change souvent)."
|
|
continue
|
|
}
|
|
|
|
try {
|
|
Write-Host "Lancement de l'installeur $name ..."
|
|
if ($g.silentargs) { Start-Process $out -ArgumentList $g.silentargs -Wait }
|
|
else { Start-Process $out }
|
|
} catch {
|
|
Write-Warning "$name : lancement de l'installeur echoue ($_)."
|
|
}
|
|
}
|
|
|
|
Write-Host "Installation des jeux lancee. Termine les eventuelles fenetres d'installation + le redemarrage impose par Vanguard."
|