Skip to content

Add native Windows driver profile support#157

Merged
HappyBasher merged 3 commits into
linuxmuster:7.4from
amolani:feature/windows-driver-profiles
Jul 23, 2026
Merged

Add native Windows driver profile support#157
HappyBasher merged 3 commits into
linuxmuster:7.4from
amolani:feature/windows-driver-profiles

Conversation

@amolani

@amolani amolani commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

The command selects Windows driver profiles using the client's current DMI vendor and product information. It downloads the small match.conf files first, transfers only matching driver payloads and prepares them for installation through Windows PnPUtil.

Existing LINBO paths for image downloads, sync hooks, mounts and registry handling are reused. No additional service, network port or dependency is introduced.

HappyBasher added a commit that referenced this pull request Jul 22, 2026
…tcha

Two gaps found while checking whether the harness is ready for the
PR #157 author to add linbo_driverpostsync tests against it:

- No example of extracting more than one function into a single test
  file, even though extract_function already supports it - relevant
  since valid_image_name/valid_profile_name would likely be tested
  together.
- No mention of the busybox-ash-vs-dash bashism trap found in
  convert_size() during Phase 1 (${var/pattern} works under ash,
  fails under dash) - worth flagging explicitly so it doesn't have to
  be rediscovered the same way for every new test.
@HappyBasher

Copy link
Copy Markdown
Member

Phase 1 of the shell-test harness (see docs/proposal-shell-test-harness.de.md) is merged on 7.4/main: tests/shell/ with a vendored shunit2, the extract_function helper, a pilot test (convert_size() in linbo_partition), a run.sh runner, and CI (shell-tests.yml, wired as a gate in release.yml). Full usage is in tests/shell/README.md.

For this PR: valid_image_name() and valid_profile_name() in linbo_driverpostsync look like solid Wave-1 candidates for a first test file here - pure case/wc/sed/tr string validation, no filesystem/device/network access, same shape as the convert_size() pilot.

A few pointers that'll save you some time:

  • extract_function takes multiple function names and concatenates them, so you can pull both valid_image_name and valid_profile_name into one test file in a single call - see the "Extracting more than one function" section in the README.
  • Test under both dash and busybox ash before you push (sh tests/shell/run.sh / busybox ash tests/shell/run.sh, or via the lmndev-runner container - see README). We hit a real gotcha during Phase 1: convert_size()'s original code passed under ash (the real linbofs runtime shell) but failed under dash due to a bash-only substitution it relied on without anyone noticing, since it had only ever been exercised on real ash clients. Your functions look clean of that pattern already, but it's worth the two-shell run to be sure.
  • The match.conf parser is still open, per the original proposal: whether to extract it into its own testable function or document it as a Wave 2 case (needs stubbing rsync/network access) is your call to make in this PR, not something Phase 1 decided for you.

Happy to help if anything in the harness itself is unclear or needs adjusting for your case.

@amolani
amolani force-pushed the feature/windows-driver-profiles branch from 40aaa38 to 588206d Compare July 22, 2026 12:08
@amolani
amolani changed the base branch from main to 7.4 July 22, 2026 12:20
@amolani

amolani commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the guidance.

I rebased the PR onto the current 7.4 branch and added focused Wave 1 tests for valid_image_name() and valid_profile_name() using the existing shell test harness.

The complete shell test suite passes under both dash and BusyBox ash. I kept the inline match.conf parser unchanged and documented it as a Wave 2 candidate, because testing it requires controlled rsync, cache, filesystem and sysfs stubs or fixtures.

No runtime behavior was changed.

@HappyBasher

Copy link
Copy Markdown
Member

One heads-up before this gets its CI run: 7.4 picked up a fix since you last rebased — the shell-tests.yml container job was failing for everyone with EACCES on actions/checkout (missing --user root on the lmndev-runner container, unrelated to your changes). That's fixed on 7.4 now.

Could you rebase/merge the current 7.4 into this branch before the workflow run gets approved? Otherwise it'll likely fail again on that unrelated infra issue rather than actually validating your tests.

@amolani
amolani force-pushed the feature/windows-driver-profiles branch from 588206d to 719231a Compare July 22, 2026 16:26
@amolani

amolani commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the current 7.4 branch, including the shell-test container fix.

The complete shell test suite passes under both dash and BusyBox ash.

@HappyBasher HappyBasher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed `linbo_driverpostsync` in full (639 lines). Solid work:

  • Input validation (`valid_image_name`/`valid_profile_name`) is fail-closed and traversal-safe before any value touches an rsync or filesystem path; Windows-reserved device names are correctly rejected too.
  • Staging + atomic swap pattern (staging → active, with a last-known-good backup) is applied consistently for both metadata and payload syncs, with crash recovery on the next run.
  • `match.conf` parsing is fail-closed (single `[match]` section, exactly one vendor, ≥1 non-empty product).
  • `pnputil-install.cmd` generation correctly maps all four documented exit codes (0/259/1641/3010) to the right self-delete/retry behavior.
  • Wave 1 tests landed and CI is green under both `dash` and BusyBox `ash`.

I also cross-checked this against `linuxmuster-tools` v7.4.10, which already renders the server-side dispatcher this pairs with: argument order/quoting match exactly, profile-name validation on that side is at least as strict (no injection path through a rendered dispatcher), and the generated dispatcher already guards with `command -v linbo_driverpostsync` so an old client without this executable gets a visible warning instead of breaking.

Non-blocking follow-ups worth tracking as separate issues rather than holding up this PR:

  • Hidden-dotfile cache leak: the "retain only current matches" cleanup loops use a bare `` glob, which doesn't match `.staging-`/`.previous-*` left behind by profiles that get unassigned or stop matching. Traced the blast radius — disk space only, not read into `/mnt/Drivers/LINBO`, but worth a follow-up fix.
  • Wave 2 test coverage (match.conf parsing, crash recovery, batch/registry generation) is still workbench-only: fine as a documented, accepted scoping decision.
  • `usage()` doesn't special-case a `help` argument the way `linbo_patch_registry` does.
  • Given `linuxmuster-tools` already shipped its side ahead of sequence, let's prioritize getting a linbo7 package with this out and into the fleet rollout — the tools-side feature is currently live but nonfunctional until then.

Approving.

@HappyBasher
HappyBasher merged commit 01d45b0 into linuxmuster:7.4 Jul 23, 2026
2 checks passed
HappyBasher added a commit that referenced this pull request Jul 23, 2026
Adds the 2026-07-23 status update: Wave 1 tests landed and CI green,
cross-repo contract verified against the already-released
linuxmuster-tools v7.4.10 dispatcher renderer (safe graceful
degradation via its command -v guard), and revises the recommendation
to Approved with the remaining items reframed as non-blocking
follow-ups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants