Files
pxe-server/playbook/sync-waxtrace.sh
cproudlock e1ea6b7c62 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) <noreply@anthropic.com>
2026-05-21 15:44:42 -04:00

102 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# sync-waxtrace.sh - Push Wax/Trace (Mitutoyo FormTracePak) bootstrap bundle
# to the PXE server enrollment share.
#
# Copies waxtrace-manifest.json + 09-Setup-WaxAndTrace.ps1 (from the
# gea-shopfloor-waxtrace/ tree) plus the big binary payload (captured master
# zip + reg + HASP + VC++ redists + per-machine cal ISOs) from the local
# workstation to /srv/samba/enrollment/installers-post/waxtrace on the PXE
# server. That directory becomes visible as
# \\172.16.9.1\enrollment\installers-post\waxtrace so startnet.cmd can xcopy
# it onto the target disk during WinPE phase (W:\WaxTrace-Install, becomes
# C:\WaxTrace-Install post-reboot).
#
# Run this on the workstation any time:
# - waxtrace-manifest.json changes
# - 09-Setup-WaxAndTrace.ps1 changes
# - A new cal ISO is added under /home/camp/pxe-images/iso/mitutoyo-cal/
# - Prereqs (VC++, HASP) are updated
# - FormTracePak vendor ISO is bumped (default v6.213, override with $FTPAK_ISO)
#
# Usage:
# ./playbook/sync-waxtrace.sh
#
# Requires: sshpass, scp, ssh, gzip (already in captured/reg/).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PXE_HOST="${PXE_HOST:-172.16.9.1}"
PXE_USER="${PXE_USER:-pxe}"
PXE_PASS="${PXE_PASS:-pxe}"
WAXTRACE_DIR="$PROJECT_ROOT/playbook/shopfloor-setup/gea-shopfloor-waxtrace"
CAL_ISO_DIR="${MITUTOYO_CAL_DIR:-/home/camp/pxe-images/iso/mitutoyo-cal}"
REMOTE_DIR="/srv/samba/enrollment/installers-post/waxtrace"
REMOTE_TEMP="/tmp/waxtrace-stage-$$"
ssh_run() {
sshpass -p "$PXE_PASS" ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR "$PXE_USER@$PXE_HOST" "$@"
}
scp_to() {
sshpass -p "$PXE_PASS" scp -o StrictHostKeyChecking=no -o LogLevel=ERROR "$@"
}
# 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/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/prereqs" "$STAGE/calibrations" "$STAGE/formtracepak"
cp "$WAXTRACE_DIR/waxtrace-manifest.json" "$STAGE/"
cp "$WAXTRACE_DIR/09-Setup-WaxAndTrace.ps1" "$STAGE/"
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
cp "$CAL_ISO_DIR/INDEX.csv" "$STAGE/calibrations/" 2>/dev/null || true
fi
echo "==> Local stage size: $(du -sh $STAGE | cut -f1)"
ls "$STAGE/"
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"
ssh_run "rm -rf '$REMOTE_TEMP' && mkdir -p '$REMOTE_TEMP'"
scp_to -r "$STAGE/." "$PXE_USER@$PXE_HOST:$REMOTE_TEMP/"
echo "==> Atomic move into $REMOTE_DIR"
ssh_run "echo $PXE_PASS | sudo -S bash -c '
mkdir -p $(dirname $REMOTE_DIR)
if [ -d $REMOTE_DIR ]; then
mv $REMOTE_DIR ${REMOTE_DIR}.pre-\$(date +%Y%m%d-%H%M%S)
fi
mv $REMOTE_TEMP $REMOTE_DIR
chown -R pxe:pxe $REMOTE_DIR
ls -la $REMOTE_DIR
'"
echo "==> Done. Next imaged Wax/Trace PC picks up the new bundle."