From e1ea6b7c62ec25c1bd6f8661dc0802b4144f58c0 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 21 May 2026 15:44:42 -0400 Subject: [PATCH] Wax/Trace: switch baseline to FormTracePak v6.213 vendor install Replace the V6.0 captured-binary replay (pf-x86-MitutoyoApp.zip + c-MitutoyoApp.zip + hklm-wow-mitutoyo.reg.gz) with a real vendor install from FORMTRACEPAK-V6.213.iso mounted via Mount-DiskImage. 09-Setup-WaxAndTrace.ps1: - Step 2 rewritten: Mount-DiskImage on C:\WaxTrace-Install\formtracepak\FORMTRACEPAK-V6.213.iso, run the VB6 Setup.exe wrapper from the assigned drive letter (DRIVE_CDROM check satisfied by virtual mount, no real CD needed), then Dismount. - Header rewritten: drop captured/ description, note legacy fallback remains in the repo (captured-binary/ unchanged) for manual recovery if the v6.213 vendor install fails on a bay. sync-waxtrace.sh: - Push formtracepak/FORMTRACEPAK-V6.213.iso (2.0 GB) into the bundle instead of captured/ payload. Override path via $FTPAK_ISO env var if needed (e.g. testing a v6.213 patch ISO). - Sanity check no longer demands pf-x86-MitutoyoApp.zip; only requires prereqs/ + the manifest + dispatcher PS1. playbook/utilities/convert-cal-iso.sh: - New helper. Rebuilds a Linux-dd of a multi-session UDF cal disc into a clean ISO9660+UDF hybrid that Windows Mount-DiskImage reads. mkisofs reads the file via loop-udf, repacks single-session with the asset tag as volume label. Run when `file CAL-*.iso` reports "data" (multi-session UDF dd produced a Linux-readable but Windows-unreadable container). Single-session 218-458A discs from dd are already ISO9660 and don't need this. Verified on win11 VM via qga: V6.213 ISO mounts, Setup.exe locatable. 14 cal ISOs all converted to ISO9660 (md5s refreshed in INDEX.csv), re-synced to /srv/samba/enrollment/installers-post/waxtrace/calibrations/. PXE share bundle now 2.0 GB total (V6.213 ISO + 14 cal ISOs + prereqs). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../09-Setup-WaxAndTrace.ps1 | 111 ++++++++---------- playbook/sync-waxtrace.sh | 28 +++-- playbook/utilities/convert-cal-iso.sh | 83 +++++++++++++ 3 files changed, 152 insertions(+), 70 deletions(-) create mode 100755 playbook/utilities/convert-cal-iso.sh 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 8509cee..c207904 100644 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 @@ -1,14 +1,10 @@ -# 09-Setup-WaxAndTrace.ps1 - Wax and Trace pc-type setup (Mitutoyo FormTracePak v6.0) +# 09-Setup-WaxAndTrace.ps1 - Wax and Trace pc-type setup (Mitutoyo FormTracePak v6.213) # -# Imaging-time install. Mitutoyo's CD-ROM-bound VB6 wrapper (Setup.exe + -# appSetup.exe) is unreliable on Win11 and requires interactive clicks -# through model + cal + HASP dialogs. We bypass it entirely: prereqs install -# via manifest, FormTracePak itself is xcopy + reg-import from a master capture. -# -# Master capture was taken 2026-05-18 on a Win11 VM with both CV-3000/4000 -# series + SV-C3000/4000 series installed via Mount-DiskImage approach (see -# project-waxtrace-image.md). Covers all WJ wax/trace bays since both series -# end up sharing the same Program Files dir + reg. +# Imaging-time install. Installs prereqs from manifest, then runs the +# Mitutoyo FormTracePak v6.213 vendor installer from a mounted ISO. The +# VB6 Setup.exe wrapper checks GetDriveType() == DRIVE_CDROM; Mount-DiskImage +# satisfies that (a real CD drive isn't required). Per-asset calibration ISO +# applies last. # # Layout at C:\WaxTrace-Install\ (xcopied by startnet.cmd): # waxtrace-manifest.json @@ -18,15 +14,17 @@ # prereqs\vc_redist.x86.exe (VC++ 2017 x86) # prereqs\vc_redist.x64.exe (VC++ 2017 x64) # prereqs\HASPUserSetup.exe (Sentinel Runtime / HASP dongle driver) -# captured\pf-x86-MitutoyoApp.zip (~108 MB compressed -> 675 MB) -# captured\c-MitutoyoApp.zip (data dir skeleton, mostly empty) -# captured\reg\hklm-wow-mitutoyo.reg.gz (gzipped, ~218 KB -> 5.4 MB) -# captured\arp-entries.json (informational - what to expect) -# calibrations\CAL-WJRP_serial-_probe-.iso (per-machine) +# formtracepak\FORMTRACEPAK-V6.213.iso (vendor installer ISO, ~2 GB) +# calibrations\CAL-_serial-_probe-.iso (per-machine) # # Per-machine calibration is applied separately (mount cal ISO + run its # Setup.exe), keyed by C:\Enrollment\machine-number.txt. # +# Legacy captured/ replay path (V6.0 zip + reg) retired 2026-05-21. The +# captured-binary/ payload is still in the repo as a fallback - if the +# v6.213 vendor install fails on a bay, fall back to the captured path +# manually. See git history for the prior shape. +# # Log: C:\Logs\WaxTrace\09-Setup-WaxAndTrace.log # C:\Logs\WaxTrace\install.log (written by Install-FromManifest) @@ -93,58 +91,53 @@ if (-not (Test-Path $manifestPath)) { } # ============================================================================ -# Step 2: Replay FormTracePak install from master capture +# Step 2: FormTracePak v6.213 vendor install (Mount-DiskImage + Setup.exe) # ============================================================================ # Detection: skip if Formtracepak already present (re-run safe). $ftpakExe = 'C:\Program Files (x86)\MitutoyoApp\Formtracepak\Formtracepak.exe' if (Test-Path -LiteralPath $ftpakExe) { - Write-WTLog "Formtracepak.exe already present - skipping replay" + Write-WTLog "Formtracepak.exe already present - skipping vendor install" } else { - $pfZip = Join-Path $stagingRoot 'captured\pf-x86-MitutoyoApp.zip' - $maZip = Join-Path $stagingRoot 'captured\c-MitutoyoApp.zip' - $regGz = Join-Path $stagingRoot 'captured\reg\hklm-wow-mitutoyo.reg.gz' - - if (-not (Test-Path $pfZip)) { - Write-WTLog "Master capture pf-x86-MitutoyoApp.zip not found at $pfZip" 'ERROR' + $ftpakIso = Join-Path $stagingRoot 'formtracepak\FORMTRACEPAK-V6.213.iso' + if (-not (Test-Path -LiteralPath $ftpakIso)) { + Write-WTLog "FormTracePak ISO not found at $ftpakIso" 'ERROR' } else { - $pfDest = 'C:\Program Files (x86)\MitutoyoApp' - Write-WTLog "Extracting $pfZip -> $pfDest" + Write-WTLog "Mounting FormTracePak ISO: $ftpakIso" try { - if (-not (Test-Path $pfDest)) { New-Item -Path $pfDest -ItemType Directory -Force | Out-Null } - Expand-Archive -Path $pfZip -DestinationPath $pfDest -Force - $count = (Get-ChildItem $pfDest -Recurse -File -ErrorAction SilentlyContinue).Count - Write-WTLog " extracted $count files" + $img = Mount-DiskImage -ImagePath $ftpakIso -PassThru -ErrorAction Stop + Start-Sleep -Seconds 8 + $vol = Get-DiskImage -ImagePath $ftpakIso | Get-Volume + $ftpakDrive = $vol.DriveLetter + if (-not $ftpakDrive) { + Write-WTLog " Mount succeeded but no drive letter assigned" 'ERROR' + } else { + Write-WTLog " mounted at ${ftpakDrive}: (volume label=$($vol.FileSystemLabel))" + $setupExe = "${ftpakDrive}:\Setup.exe" + if (-not [System.IO.File]::Exists($setupExe)) { + Write-WTLog " Setup.exe not found at $setupExe" 'ERROR' + } else { + Write-WTLog " running $setupExe (VB6 wrapper - requires DRIVE_CDROM)" + # Setup.exe is the VB6 wrapper. /silent + /qn flags often + # ignored - the wrapper drives appSetup.exe + msiexec from + # its own UI. If the wrapper insists on interactive, a tech + # at the bay clicks through. Acceptable today; quieter + # path is a future improvement (drive msiexec direct on + # the wrapper's bundled MSIs). + try { + $p = Start-Process -FilePath $setupExe ` + -WorkingDirectory "${ftpakDrive}:\" ` + -ArgumentList '/silent' ` + -Wait -PassThru + Write-WTLog " Setup.exe exit $($p.ExitCode)" + } catch { + Write-WTLog " Setup.exe failed: $_" 'ERROR' + } + } + } + Dismount-DiskImage -ImagePath $ftpakIso -ErrorAction SilentlyContinue | Out-Null + Write-WTLog " FormTracePak ISO dismounted" } catch { - Write-WTLog " Expand-Archive failed: $_" 'ERROR' - } - } - - if (Test-Path $maZip) { - $maDest = 'C:\MitutoyoApp' - Write-WTLog "Extracting $maZip -> $maDest" - try { - if (-not (Test-Path $maDest)) { New-Item -Path $maDest -ItemType Directory -Force | Out-Null } - Expand-Archive -Path $maZip -DestinationPath $maDest -Force - } catch { - Write-WTLog " Expand-Archive failed: $_" 'WARN' - } - } - - if (Test-Path $regGz) { - $regOut = Join-Path $env:TEMP 'hklm-wow-mitutoyo.reg' - Write-WTLog "Decompressing $regGz -> $regOut" - try { - $inGz = [IO.File]::OpenRead($regGz) - $gz = New-Object IO.Compression.GZipStream($inGz, [IO.Compression.CompressionMode]::Decompress) - $out = [IO.File]::Create($regOut) - $gz.CopyTo($out) - $out.Close(); $gz.Close(); $inGz.Close() - Write-WTLog "Importing reg file via reg.exe /s" - & reg.exe import $regOut 2>&1 | ForEach-Object { Write-WTLog " reg: $_" } - Write-WTLog " reg import exit $LASTEXITCODE" - Remove-Item $regOut -Force -ErrorAction SilentlyContinue - } catch { - Write-WTLog " reg import failed: $_" 'ERROR' + Write-WTLog " Mount-DiskImage failed: $_" 'ERROR' } } } diff --git a/playbook/sync-waxtrace.sh b/playbook/sync-waxtrace.sh index f8426eb..fc97cb6 100755 --- a/playbook/sync-waxtrace.sh +++ b/playbook/sync-waxtrace.sh @@ -13,9 +13,10 @@ # # Run this on the workstation any time: # - waxtrace-manifest.json changes -# - The captured master is rebuilt (captured-binary/ + captured/) +# - 09-Setup-WaxAndTrace.ps1 changes # - A new cal ISO is added under /home/camp/pxe-images/iso/mitutoyo-cal/ -# - Prereqs are updated +# - Prereqs (VC++, HASP) are updated +# - FormTracePak vendor ISO is bumped (default v6.213, override with $FTPAK_ISO) # # Usage: # ./playbook/sync-waxtrace.sh @@ -48,23 +49,28 @@ scp_to() { # Sanity check test -f "$WAXTRACE_DIR/waxtrace-manifest.json" || { echo "Missing $WAXTRACE_DIR/waxtrace-manifest.json"; exit 1; } test -f "$WAXTRACE_DIR/09-Setup-WaxAndTrace.ps1" || { echo "Missing 09-Setup-WaxAndTrace.ps1"; exit 1; } -test -d "$WAXTRACE_DIR/captured-binary" || { echo "Missing $WAXTRACE_DIR/captured-binary (run capture-ftpak.ps1 first)"; exit 1; } -test -f "$WAXTRACE_DIR/captured-binary/pf-x86-MitutoyoApp.zip" || { echo "Missing master capture zip"; exit 1; } -test -d "$WAXTRACE_DIR/captured-binary/prereqs" || { echo "Missing prereqs dir"; exit 1; } +test -d "$WAXTRACE_DIR/captured-binary/prereqs" || { echo "Missing $WAXTRACE_DIR/captured-binary/prereqs (VC++/HASP installers)"; exit 1; } echo "==> Staging tree locally" STAGE="$(mktemp -d -p /tmp waxtrace-stage.XXXXXX)" trap "rm -rf $STAGE" EXIT -mkdir -p "$STAGE/captured/reg" "$STAGE/prereqs" "$STAGE/calibrations" +mkdir -p "$STAGE/prereqs" "$STAGE/calibrations" "$STAGE/formtracepak" cp "$WAXTRACE_DIR/waxtrace-manifest.json" "$STAGE/" cp "$WAXTRACE_DIR/09-Setup-WaxAndTrace.ps1" "$STAGE/" -cp -r "$WAXTRACE_DIR/captured/." "$STAGE/captured/" -cp "$WAXTRACE_DIR/captured-binary/pf-x86-MitutoyoApp.zip" "$STAGE/captured/" -cp "$WAXTRACE_DIR/captured-binary/hklm-wow-mitutoyo.reg" "$STAGE/captured/reg/" 2>/dev/null || true -cp "$WAXTRACE_DIR/captured-binary/c-MitutoyoApp.zip" "$STAGE/captured/" 2>/dev/null || true cp "$WAXTRACE_DIR/captured-binary/prereqs/"*.exe "$STAGE/prereqs/" +# FormTracePak v6.213 vendor installer ISO (2 GB). Pulled from +# /home/camp/pxe-images/iso/. Bay xcopies + Mount-DiskImage's at imaging +# time. Replaces the legacy captured/ replay path; the old captured-binary/ +# dir remains in the repo as a manual fallback but is no longer pushed. +FTPAK_ISO="${FTPAK_ISO:-/home/camp/pxe-images/iso/FORMTRACEPAK-V6.213.iso}" +if [ -f "$FTPAK_ISO" ]; then + cp "$FTPAK_ISO" "$STAGE/formtracepak/" +else + echo "WARNING: FormTracePak ISO not found at $FTPAK_ISO - bays cannot install at imaging time." +fi + # Cal ISOs - one per wax/trace bay if [ -d "$CAL_ISO_DIR" ]; then cp "$CAL_ISO_DIR"/CAL-*.iso "$STAGE/calibrations/" 2>/dev/null || true @@ -73,8 +79,8 @@ fi echo "==> Local stage size: $(du -sh $STAGE | cut -f1)" ls "$STAGE/" -ls "$STAGE/captured/" ls "$STAGE/prereqs/" +ls "$STAGE/formtracepak/" 2>/dev/null || echo "(no FormTracePak ISO)" ls "$STAGE/calibrations/" 2>/dev/null || echo "(no cal ISOs)" echo "==> Pushing to $PXE_USER@$PXE_HOST:$REMOTE_TEMP" diff --git a/playbook/utilities/convert-cal-iso.sh b/playbook/utilities/convert-cal-iso.sh new file mode 100755 index 0000000..4053604 --- /dev/null +++ b/playbook/utilities/convert-cal-iso.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Convert a Linux-dd multi-session UDF cal ISO into a Windows-readable +# single-session ISO+UDF hybrid. Mounts the dd file via UDF loop, copies +# files into a temp tree, repacks via mkisofs with ISO9660+UDF. +# +# Use this when a Mitutoyo cal disc was ripped with `dd if=/dev/sr0` +# (default Linux rip). For multi-session UDF discs `dd` captures session +# 1 only and truncates trailing UDF Anchor Volume Descriptor Pointers; +# the file mounts on Linux (loop-udf) but Windows Mount-DiskImage reports +# IsReady=False. mkisofs rebuilds clean metadata Windows reads. Linux +# still reads the result. +# +# Single-session discs (older 218-458A Mitutoyo pattern) are already +# ISO9660 from dd - no conversion needed. Run `file CAL-*.iso`: +# ISO 9660 = fine; "data" = convert. +# +# Usage: convert-cal-iso.sh +# Replaces input in place. Saves .dd-backup on first run. +# +# Requires: sudo (loop-udf mount), mkisofs (genisoimage / cdrtools). + +set -euo pipefail + +ISO="$1" +test -f "$ISO" || { echo "Missing: $ISO"; exit 1; } + +# Extract label from filename, e.g. CAL-WJF00052_... -> 12AAE675-ish. +# Use the asset tag as the volume label so it stays unique + greppable. +ASSET=$(basename "$ISO" | sed -n 's/^CAL-\([A-Za-z0-9]*\)_.*/\1/p') +test -n "$ASSET" || { echo "Could not parse asset from $ISO"; exit 1; } +LABEL="CAL-$ASSET" + +# Length cap: ISO9660 vol id <= 32 chars +LABEL="${LABEL:0:32}" + +STAGE=$(mktemp -d -p /tmp calconv.XXXX) +MNT="$STAGE/mnt" +TREE="$STAGE/tree" +mkdir -p "$MNT" "$TREE" + +cleanup() { + if mountpoint -q "$MNT"; then sudo umount "$MNT" 2>/dev/null || true; fi + rm -rf "$STAGE" +} +trap cleanup EXIT + +echo "[$ASSET] mount $ISO" +sudo mount -t udf -o loop,ro "$ISO" "$MNT" + +echo "[$ASSET] copy" +cp -a "$MNT/." "$TREE/" + +sudo umount "$MNT" +rmdir "$MNT" 2>/dev/null || true + +# Verify expected files present (case-insensitive: older WJRP discs use Setup.exe) +test -d "$TREE/data" -o -d "$TREE/Data" -o -d "$TREE/DATA" || { echo "[$ASSET] missing data/ dir in tree"; exit 1; } +find "$TREE" -maxdepth 1 -iname 'setup.exe' -type f -print -quit | grep -q . || { echo "[$ASSET] missing setup.exe in tree"; exit 1; } + +NEW="$STAGE/new.iso" +echo "[$ASSET] mkisofs -> $NEW" +mkisofs -V "$LABEL" \ + -udf \ + -iso-level 3 \ + -J -joliet-long \ + -r \ + -o "$NEW" \ + "$TREE" 2>&1 | tail -3 + +NEW_SIZE=$(stat -c %s "$NEW") +echo "[$ASSET] new size: $NEW_SIZE" + +# Replace original (backup the dd version once) +BACKUP="${ISO}.dd-backup" +if [ ! -f "$BACKUP" ]; then + mv "$ISO" "$BACKUP" + echo "[$ASSET] backed up dd version -> $BACKUP" +else + rm "$ISO" +fi + +mv "$NEW" "$ISO" +echo "[$ASSET] replaced. md5: $(md5sum $ISO | cut -d' ' -f1)"