09-Setup-WaxAndTrace.ps1 Step 3: - Detect Mitutoyo's burn-time typo on 218-378-13 series cal discs (filenames carry a trailing space inside the probe ID component, e.g. "Linear_X_218-378-13 _100072210.txt"). Their own .NET Setup.exe calls FileSystemInfo.set_Attributes on the source path and throws System.ArgumentException because the path contains an embedded space component, crashing every cal apply on 218-378-13 bays (exit -532462766 = 0xE0434352, .NET unhandled exception). Confirmed via WER Event 1026 captured during today's WJF00159 imaging. - When the buggy filenames are detected, bypass the broken vendor Setup.exe and direct-copy data\*.* into C:\Program Files (x86)\MitutoyoApp\Formtracepak\data\, renaming each file to strip ' _' (space-underscore) -> '_'. Clear read-only attr on each landed file. Older 218-458A discs have clean filenames and still use the vendor Setup.exe path. waxtrace-manifest.json: - Drop DetectionValue=v14.15.26706 from both VC++ 2017 redist entries. Windows Update routinely bumps the VS14 runtime to 14.16+ / 14.3x+, the older Mitutoyo redist refuses to install over the newer (exit 1638 'Another version already installed') and the manifest engine marked it as failed even though the runtime was fine. Detection is now by registry-key+name presence, which any VC++ 2015-2022 redist satisfies (they are backward-compatible). startnet.cmd:prompt_waxtrace_asset: - Replace free-text input with select-waxtrace-asset.ps1 arrow-key picker driven from installers-post/waxtrace/calibrations/INDEX.csv. - Map Y: enrollment share early so the picker can read INDEX.csv. - Replace parens-in-parens block (echo of '(e.g. WJRP2335)' inside the if-paren caused 'to was unexpected at this time' parse error observed by tech mid-imaging) with goto-flow. - Fall back to free-text prompt if picker unavailable or operator presses Esc. select-waxtrace-asset.ps1: - Sort bays descending by asset tag so WJRP* lands at top of menu. - Also staged as gea-shopfloor-waxtrace/select-waxtrace-asset.ps1 so sync-waxtrace.sh ships it to installers-post/waxtrace/ on the share. sync-waxtrace.sh: - Push select-waxtrace-asset.ps1 next to INDEX.csv on the share. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
108 lines
4.2 KiB
Bash
Executable File
108 lines
4.2 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/"
|
|
# Arrow-key picker invoked from startnet.cmd. Reads INDEX.csv to build the
|
|
# menu, falls back to free-text prompt if it errors. Lives next to the
|
|
# calibrations dir since it depends on INDEX.csv being adjacent.
|
|
if [ -f "$WAXTRACE_DIR/select-waxtrace-asset.ps1" ]; then
|
|
cp "$WAXTRACE_DIR/select-waxtrace-asset.ps1" "$STAGE/"
|
|
fi
|
|
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."
|