Wax/Trace: auto-restore captured backup ZIP during imaging
Wires the three pieces that make the per-bay backup restore happen as part of the PXE imaging pass, no manual post-imaging step required: 1. sync-waxtrace.sh: stage per-asset backup ZIPs from /home/camp/pxe-images/wt/<asset>/formtracepak_backup_*.zip (newest) into installers-post/waxtrace/backups/<asset>.zip on the PXE share. Also pushes scripts/Install-FormtracepakSettings.ps1 alongside the bootstrap bundle so 09-Setup can call it post-vendor-install. 2. startnet.cmd: after the FTPak ISO cherry-pick, xcopy Y:\installers-post\waxtrace\backups\%MACHINENUM%.zip to W:\WaxTrace-Install\backup\%MACHINENUM%.zip. Logs INFO if no per-asset ZIP exists - 09-Setup will then skip the restore step. 3. 09-Setup-WaxAndTrace.ps1 Step 3b: between cal ISO and OpenText auto-start steps, look for C:\WaxTrace-Install\backup\<asset>.zip and invoke Install-FormtracepakSettings.ps1 -BackupPath ... -RestoreData -RestoreConfig -Force. Registry restore is intentionally omitted - captured HKLM is overwritten by the vendor MSI install in Step 2 anyway, and captured HKEY_USERS would land at the source bay's SID (which doesn't exist on the freshly imaged bay). bay-config.csv refresh: 17 captured bays with full version/model/ user_id/hw_sn/hw_id/host. Versions stick to the original bay-config.csv target values where the live binary drifted to a release we don't have an ISO for (e.g. WJRP2035 live 5.7.0.82 -> imaging targets 6.0). WJF00450 flagged MISSING_DATA in user_id + hw_id columns so the imaging path aborts cleanly until the dongle is read. Smoke tested on win11 VM with WJF00545's real capture: staged the expected bay-side layout (C:\WaxTrace-Install\Install-FormtracepakSettings.ps1 + C:\WaxTrace-Install\backup\WJF00545.zip), invoked the resolve + call path from a simulated Step 3b - 17 files restored cleanly, 0 errors.
This commit is contained in:
@@ -318,6 +318,45 @@ if (-not $asset) {
|
||||
}
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Step 3b: Restore captured layouts / prefs / data from per-asset backup ZIP
|
||||
# ============================================================================
|
||||
# startnet.cmd stages C:\WaxTrace-Install\backup\<asset>.zip iff the PXE
|
||||
# share has a backup ZIP for this asset. The ZIP is the output of
|
||||
# Backup-FormtracepakSettings.ps1 captured on the LIVE bay BEFORE re-imaging.
|
||||
# Restore is data + config only - skip -RestoreRegistry until the HKEY_USERS
|
||||
# SID rewriting is built (captured .reg carries source bay's user SID which
|
||||
# does not exist on the freshly imaged bay). HKLM controller config / model
|
||||
# device-map / etc. came from the vendor MSI install in Step 2 already.
|
||||
$backupZip = $null
|
||||
$backupDir = 'C:\WaxTrace-Install\backup'
|
||||
if ($bayAsset -and (Test-Path -LiteralPath $backupDir)) {
|
||||
$candidate = Join-Path $backupDir ("$bayAsset.zip")
|
||||
if (Test-Path -LiteralPath $candidate) {
|
||||
$backupZip = $candidate
|
||||
} else {
|
||||
$newest = Get-ChildItem -LiteralPath $backupDir -Filter "${bayAsset}*.zip" -File -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if ($newest) { $backupZip = $newest.FullName }
|
||||
}
|
||||
}
|
||||
if ($backupZip) {
|
||||
$installPs1 = Join-Path $stagingRoot 'Install-FormtracepakSettings.ps1'
|
||||
if (Test-Path -LiteralPath $installPs1) {
|
||||
Write-WTLog "Restoring per-asset backup from $backupZip"
|
||||
try {
|
||||
& $installPs1 -BackupPath $backupZip -RestoreData -RestoreConfig -Force
|
||||
Write-WTLog " Restore call returned (see restore log + Install-FormtracepakSettings output above)"
|
||||
} catch {
|
||||
Write-WTLog " Restore call threw: $_" 'WARN'
|
||||
}
|
||||
} else {
|
||||
Write-WTLog "Install-FormtracepakSettings.ps1 not found at $installPs1 - skipping restore" 'WARN'
|
||||
}
|
||||
} else {
|
||||
Write-WTLog "No per-asset backup ZIP at $backupDir\$bayAsset.zip - skipping restore (clean vendor install only)"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Step 4: OpenText auto-start at login (HostExplorer "WJ Shopfloor" session)
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user