diff --git a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 index be7fe63..5b419b4 100644 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 @@ -224,9 +224,24 @@ if (Test-Path -LiteralPath $mnPath) { if (-not $asset) { Write-WTLog "machine-number.txt missing or empty - skipping calibration apply" 'WARN' } else { + # Consistency: a per-asset backup ZIP (restored in Step 3b with HKLM + data + # + config, including the probe cal tables) is the single authoritative cal + # source. When one is staged - true for every migrated bay - skip the + # redundant, fragile cal-ISO mount/vendor-Setup path so all bays follow one + # flow (app ISO + backup restore), same as bays that never had a cal ISO. + # A future bay with a cal ISO but no backup still falls through to the ISO. + $haveBackup = @('C:\WaxTrace-Install\backups','C:\WaxTrace-Install\backup') | + Where-Object { Test-Path -LiteralPath $_ } | + ForEach-Object { Get-ChildItem -LiteralPath $_ -Filter "${asset}*.zip" -File -ErrorAction SilentlyContinue } | + Select-Object -First 1 $calDir = Join-Path $stagingRoot 'calibrations' - $candidate = Get-ChildItem $calDir -Filter "CAL-${asset}_*.iso" -ErrorAction SilentlyContinue | Select-Object -First 1 - if (-not $candidate) { + $candidate = $null + if (-not $haveBackup) { + $candidate = Get-ChildItem $calDir -Filter "CAL-${asset}_*.iso" -ErrorAction SilentlyContinue | Select-Object -First 1 + } + if ($haveBackup) { + Write-WTLog "Per-asset backup ZIP present ($($haveBackup.Name)) - skipping cal ISO; calibration restored from backup (Step 3b)" + } elseif (-not $candidate) { Write-WTLog "No cal ISO matched CAL-${asset}_*.iso in $calDir - skipping" 'WARN' } else { Write-WTLog "Mounting cal ISO: $($candidate.FullName)"