Shopfloor imaging: CMM type, Configure-PC override fix, serial drivers
- CMM imaging pipeline: WinPE-staged bootstrap + on-logon enforcer against tsgwp00525 share, manifest-driven installer runner shared via Install-FromManifest.ps1. Installs PC-DMIS 2016/2019 R2, CLM 1.8, goCMM; enables .NET 3.5 prereq; registers GE CMM Enforce logon task for ongoing version enforcement. - Shopfloor serial drivers: StarTech PCIe serial + Prolific PL2303 USB-to-serial via Install-Drivers.cmd wrapper calling pnputil /add-driver /subdirs /install. Scoped to Standard PCs. - OpenText extended to CMM/Keyence/Genspect/WaxAndTrace via preinstall.json PCTypes; Defect Tracker added to CMM profile desktopApps + taskbarPins. - Configure-PC startup-item toggle now persists across the logon sweep via C:\\ProgramData\\GE\\Shopfloor\\startup-overrides.json; 06-OrganizeDesktop Phase 3 respects suppressed items. - Get-ProfileValue helper added to Shopfloor/lib/Get-PCProfile.ps1; distinguishes explicit empty array from missing key (fixes Lab getting Plant Apps in startup because empty array was falsy). - 06-OrganizeDesktop gains transcript logging at C:\\Logs\\SFLD\\ 06-OrganizeDesktop.log and now deletes the stale Shopfloor Intune Sync task when C:\\Enrollment\\sync-complete.txt is present (task was registered with Limited principal and couldn't self-unregister). - startnet.cmd CMM xcopy block (gated on pc-type=CMM) stages the bundle to W:\\CMM-Install during WinPE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
131
playbook/sync-cmm.sh
Executable file
131
playbook/sync-cmm.sh
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
# sync-cmm.sh - Push CMM bootstrap bundle to the PXE server enrollment share.
|
||||
#
|
||||
# Copies the Hexagon installers + cmm-manifest.json from the local workstation
|
||||
# to /srv/samba/enrollment/cmm-installers on the PXE server. That directory
|
||||
# becomes visible as \\10.9.100.1\enrollment\cmm-installers so startnet.cmd
|
||||
# can xcopy it onto the target disk during WinPE phase.
|
||||
#
|
||||
# Run this on the workstation (not on the PXE server) any time:
|
||||
# - You update cmm-manifest.json in playbook/shopfloor-setup/CMM/
|
||||
# - You drop new/updated installers into /home/camp/pxe-images/cmm/hexagon/
|
||||
#
|
||||
# Same pattern as sync-preinstall.sh. The remote tree is updated in place and
|
||||
# the next imaged CMM PC picks up the new files automatically.
|
||||
#
|
||||
# Usage:
|
||||
# ./playbook/sync-cmm.sh
|
||||
#
|
||||
# Requires: sshpass (apt install sshpass), scp, ssh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Config ---
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
PXE_HOST="${PXE_HOST:-10.9.100.1}"
|
||||
PXE_USER="${PXE_USER:-pxe}"
|
||||
PXE_PASS="${PXE_PASS:-pxe}"
|
||||
|
||||
MANIFEST_SRC="$PROJECT_ROOT/playbook/shopfloor-setup/CMM/cmm-manifest.json"
|
||||
INSTALLERS_SRC="${CMM_INSTALLERS_DIR:-/home/camp/pxe-images/cmm/hexagon}"
|
||||
|
||||
REMOTE_DIR="/srv/samba/enrollment/cmm-installers"
|
||||
REMOTE_TEMP="/tmp/cmm-stage"
|
||||
|
||||
# --- Helpers ---
|
||||
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 "$1" "$PXE_USER@$PXE_HOST:'$2'"
|
||||
}
|
||||
|
||||
# --- Validate sources ---
|
||||
echo "Validating source files..."
|
||||
|
||||
if [ ! -f "$MANIFEST_SRC" ]; then
|
||||
echo "ERROR: cmm-manifest.json not found at $MANIFEST_SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf " OK %10d cmm-manifest.json\n" "$(stat -c %s "$MANIFEST_SRC")"
|
||||
|
||||
if [ ! -d "$INSTALLERS_SRC" ]; then
|
||||
echo "ERROR: installers dir not found: $INSTALLERS_SRC" >&2
|
||||
echo " Set CMM_INSTALLERS_DIR env var to override the default" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
installers=()
|
||||
while IFS= read -r f; do
|
||||
installers+=("$f")
|
||||
done < <(find "$INSTALLERS_SRC" -maxdepth 1 -type f -name '*.exe' | sort)
|
||||
|
||||
if [ "${#installers[@]}" -eq 0 ]; then
|
||||
echo "ERROR: no .exe files under $INSTALLERS_SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
total_bytes=0
|
||||
for f in "${installers[@]}"; do
|
||||
size=$(stat -c %s "$f")
|
||||
total_bytes=$((total_bytes + size))
|
||||
printf " OK %10d %s\n" "$size" "$(basename "$f")"
|
||||
done
|
||||
printf " Total payload: %d bytes (%.1f GB)\n" "$total_bytes" "$(echo "scale=2; $total_bytes/1073741824" | bc)"
|
||||
|
||||
# --- Verify PXE server reachable ---
|
||||
echo "Pinging PXE server $PXE_HOST..."
|
||||
if ! ping -c 1 -W 2 "$PXE_HOST" >/dev/null 2>&1; then
|
||||
echo "ERROR: PXE server $PXE_HOST not reachable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Stage files to /tmp on PXE, then sudo install to enrollment share ---
|
||||
echo "Staging files to $PXE_HOST:$REMOTE_TEMP..."
|
||||
ssh_run "rm -rf $REMOTE_TEMP && mkdir -p $REMOTE_TEMP/files"
|
||||
|
||||
echo " -> cmm-manifest.json"
|
||||
scp_to "$MANIFEST_SRC" "$REMOTE_TEMP/files/cmm-manifest.json"
|
||||
|
||||
for f in "${installers[@]}"; do
|
||||
base="$(basename "$f")"
|
||||
echo " -> $base"
|
||||
scp_to "$f" "$REMOTE_TEMP/files/$base"
|
||||
done
|
||||
|
||||
# --- Build remote install script (runs under sudo on PXE) ---
|
||||
LOCAL_TEMP_SCRIPT="$(mktemp /tmp/sync-cmm-remote.XXXXXX.sh)"
|
||||
trap 'rm -f "${LOCAL_TEMP_SCRIPT:-}"' EXIT
|
||||
|
||||
cat > "$LOCAL_TEMP_SCRIPT" <<REMOTE_SCRIPT
|
||||
#!/bin/bash
|
||||
set -e
|
||||
mkdir -p "$REMOTE_DIR"
|
||||
|
||||
# Fresh deploy: remove stale files (old installer versions) so a shrinking
|
||||
# manifest doesn't leave orphan binaries on the share.
|
||||
find "$REMOTE_DIR" -maxdepth 1 -type f -delete
|
||||
|
||||
cp "$REMOTE_TEMP/files/"* "$REMOTE_DIR/"
|
||||
|
||||
chown -R root:root "$REMOTE_DIR"
|
||||
find "$REMOTE_DIR" -type f -exec chmod 0644 {} +
|
||||
find "$REMOTE_DIR" -type d -exec chmod 0755 {} +
|
||||
|
||||
rm -rf "$REMOTE_TEMP"
|
||||
|
||||
echo
|
||||
echo "Final state of $REMOTE_DIR:"
|
||||
ls -la "$REMOTE_DIR"
|
||||
REMOTE_SCRIPT
|
||||
|
||||
scp_to "$LOCAL_TEMP_SCRIPT" "$REMOTE_TEMP/_install.sh"
|
||||
|
||||
echo "Installing files to $REMOTE_DIR (sudo)..."
|
||||
ssh_run "echo '$PXE_PASS' | sudo -S bash $REMOTE_TEMP/_install.sh"
|
||||
|
||||
echo
|
||||
echo "Done. CMM bootstrap synced to $PXE_HOST:$REMOTE_DIR"
|
||||
Reference in New Issue
Block a user