Files
pxe-server/playbook/sync-waxtrace.sh
cproudlock 37357eee43 Shopfloor images: add Wax/Trace + Keyence per-model variants
Wax/Trace (gea-shopfloor-waxtrace):
- captured/ holds master FormTracePak v6.0 state (Program Files reg dump
  gzipped, ARP entries) taken from a win11 VM where the CD-ROM-bound VB6
  wrapper was driven to completion. xcopy + reg-import replays the install
  on real bays without running the wrapper itself.
- 09-Setup-WaxAndTrace.ps1 rewrites the stub: installs prereqs via manifest
  (VC++ 2008/2017 x86+x64, Sentinel HASP), expands the captured zips into
  C:\Program Files (x86)\MitutoyoApp + C:\MitutoyoApp, imports the reg
  hive, then mounts the bay's per-machine cal ISO (matched by asset tag
  in machine-number.txt) and runs its Setup.exe.
- waxtrace-manifest.json lists the 5 prereqs with InstallShield-style
  silent flags verified on the win11 VM.
- sync-waxtrace.sh ships captured-binary/ + prereqs + cal ISOs from
  /home/camp/pxe-images/iso/mitutoyo-cal/ to
  /srv/samba/enrollment/installers-post/waxtrace/ on the PXE box.
- select-waxtrace-asset.ps1 arrow-key bay picker for WinPE (parses
  INDEX.csv from the cal share, offers "Other (new bay)" fallback).
- startnet.cmd: prompt_waxtrace_asset prompt, skip_waxtrace_stage xcopy
  block (mirrors :skip_cmm_stage), machine-number.txt write covers bay
  asset tag (WJRP*).

Keyence (gea-shopfloor-keyence) - now multi-model:
- vr3000/manifest.json + vr5000/manifest.json + vr6000/manifest.json
  (current single-model VR-6000 moved into vr6000/ subdir). Each ships
  the model's MSI silent-install + DetectionPath via ProductCode.
  Big payloads (Data1.cab, Data11.cab) gitignored, staged via
  sync-keyence.sh from /home/camp/pxe-images/iso/keyence/.
- 09-Setup-Keyence.ps1 dispatches by C:\Enrollment\keyence-model.txt
  (written by startnet.cmd in :keyence_submenu) and points
  InstallerRoot at C:\KeyenceInstall\<model>. DXSETUP probe widened
  to all three Program Files paths (VR-3000 G2, VR-5000, VR-6000).
- startnet.cmd: :keyence_submenu picks vr3000/vr5000/vr6000,
  :skip_keyence_stage xcopy block selectively stages chosen model bundle,
  pc-subtype.txt also written = drops directly into existing GE-Enforce
  PCSubType wiring (looks for gea-shopfloor-keyence-<model>\manifest.json
  on the tsgwp00525 share for ongoing enforcement, no dispatcher change
  needed).
- sync-keyence.sh mirrors sync-waxtrace.sh pattern.

Verified silent MSI install for VR-3000 G2 v2.5.0 and VR-5000 v3.3.1 on
the win11 VM 2026-05-18 with /qn /norestart ALLUSERS=1 REBOOT=ReallySuppress
TRANSFORMS=1033.mst. boot.wim on 172.16.9.1 wimupdate'd with the new
startnet.cmd.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 16:34:20 -04:00

96 lines
3.8 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
# - The captured master is rebuilt (captured-binary/ + captured/)
# - A new cal ISO is added under /home/camp/pxe-images/iso/mitutoyo-cal/
# - Prereqs are updated
#
# 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" || { 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; }
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"
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/"
# 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/captured/"
ls "$STAGE/prereqs/"
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."