# Customer-friendly wrapper around JackAILocal-Update-Offline.ps1. # Finds a signed update package on removable drives or in the local "update" # folder, verifies it (dry run), then asks for confirmation before applying. [CmdletBinding()] param() $ErrorActionPreference = "Stop" $Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path $candidates = @() foreach ($disk in (Get-CimInstance Win32_LogicalDisk | Where-Object { $_.DriveType -eq 2 })) { $driveRoot = $disk.DeviceID + "\" if (Test-Path (Join-Path $driveRoot "update-manifest.json")) { $candidates += Get-Item $driveRoot } $candidates += Get-ChildItem -Path $driveRoot -Directory -ErrorAction SilentlyContinue | Where-Object { Test-Path (Join-Path $_.FullName "update-manifest.json") } } $localUpdate = Join-Path $Root "update" if (Test-Path (Join-Path $localUpdate "update-manifest.json")) { $candidates += Get-Item $localUpdate } if (-not $candidates) { Write-Host "" Write-Host "Aucun package de mise a jour trouve. / No update package found." -ForegroundColor Yellow Write-Host "Inserez la cle USB de mise a jour, ou placez le package dans le dossier 'update'." Write-Host "Insert the update USB key, or put the package in the 'update' folder." exit 1 } $package = $candidates | Select-Object -First 1 Write-Host ("Package trouve / Package found: {0}" -f $package.FullName) -ForegroundColor Cyan Write-Host "" # Dry run: verifies the signature and every checksum without touching files. & (Join-Path $PSScriptRoot "JackAILocal-Update-Offline.ps1") -PackagePath $package.FullName $answer = Read-Host "Appliquer cette mise a jour ? / Apply this update? (OUI/YES)" if ($answer -in @("OUI", "YES", "oui", "yes", "Oui", "Yes")) { & (Join-Path $PSScriptRoot "JackAILocal-Update-Offline.ps1") -PackagePath $package.FullName -Apply } else { Write-Host "Annule. / Cancelled." }