From ea93c3e08c792f716a6fb113230d554a4474227f Mon Sep 17 00:00:00 2001 From: cproudlock Date: Fri, 8 May 2026 17:23:21 -0400 Subject: [PATCH] download-drivers: fix BIOS push path + 3-col models.txt + don't overwrite Three related fixes: 1. Hard-coded BIOS push path was /srv/samba/enrollment/BIOS, which does not exist on the live PXE server. Real path is the shared /srv/samba/winpeapps/_shared/BIOS/ where check-bios.cmd lives and playbook task pxe_server_setup.yml:485 deploys Flash64W.exe + the per-model BIOS .exe files. 2. Generated models.txt was 2-column (ModelSubstring|BIOSFile) but check-bios.cmd reads tokens=1,2,3 with delims=| and uses field 3 for the version compare. Without the 3rd column, the version-skip logic never engages and every imaged PC re-flashes BIOS on every boot. Now writes 3-column (ModelSubstring|BIOSFile|Version). 3. The script overwrote the live models.txt with only the entries it touched in the current run. Live had 50+ entries; a single-model run wiped the other 49. Now prints the lines and asks the operator to merge them into playbook/shopfloor-setup/BIOS/models.txt and re-deploy via scripts/deploy-bios.sh. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/download-drivers.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/scripts/download-drivers.py b/scripts/download-drivers.py index 0ddfc57..b79d735 100755 --- a/scripts/download-drivers.py +++ b/scripts/download-drivers.py @@ -714,9 +714,12 @@ def main(): for i, d in enumerate(download_plan, 1)] concurrent.futures.wait(futures) - # --- Download BIOS (goes to enrollment share, shared across all images) --- + # --- Download BIOS (goes to shared winpeapps dir, read by check-bios.cmd + # in WinPE phase via \\10.9.100.1\winpeapps\_shared\BIOS\). Playbook + # task at pxe_server_setup.yml:485 deploys check-bios.cmd + Flash64W.exe + # to this same directory. --- bios_ok = bios_err = 0 - bios_dir = "/srv/samba/enrollment/BIOS" + bios_dir = "/srv/samba/winpeapps/_shared/BIOS" if bios_updates: print(f"{'=' * 60}") print(f" BIOS Updates -> {bios_dir}") @@ -736,7 +739,7 @@ def main(): if existing == b["version"]: with _lock: print(f" Up to date (v{b['version']})") - models_txt.append(f"{b['model']}|{b['filename']}") + models_txt.append(f"{b['model']}|{b['filename']}|{b['version']}") return # BIOS .exe goes as-is (not extracted) @@ -769,18 +772,24 @@ def main(): print(f" [{b['model']}] Done.") bios_ok += 1 manifest.setdefault("BIOS", {})[b["model"]] = b["version"] - models_txt.append(f"{b['model']}|{b['filename']}") + models_txt.append(f"{b['model']}|{b['filename']}|{b['version']}") with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as pool: futures = [pool.submit(_process_one_bios, b) for b in bios_updates] concurrent.futures.wait(futures) - # Generate models.txt for check-bios.cmd + # Print manifest entries for check-bios.cmd. Do NOT overwrite the + # live models.txt: this script only knows about the entries it + # touched this run, so an overwrite would wipe the 50+ existing + # entries. Instead print so the operator can merge them into + # playbook/shopfloor-setup/BIOS/models.txt and re-deploy. + # Format: ModelSubstring|BIOSFile|Version (check-bios.cmd reads + # tokens=1,2,3 with delims=|; field 3 used for version compare). if models_txt: - manifest_content = "# ModelSubstring|BIOSFile\\n" + "\\n".join(models_txt) + "\\n" - ssh_cmd(args.server, - f"printf '{manifest_content}' > '{bios_dir}/models.txt'") - print(f"\n models.txt updated ({len(models_txt)} entries)") + print(f"\n Add these lines to playbook/shopfloor-setup/BIOS/models.txt:") + for line in models_txt: + print(f" {line}") + print(f" Then re-deploy via scripts/deploy-bios.sh.") # --- Save manifest --- completed, skipped, errors = counters["completed"], counters["skipped"], counters["errors"]