Documentation
¶
Overview ¶
Package usersync is the per-user helper's work (`<slug>-ui.exe --user-sync`): it asks the service for the user-placement plan, places each tree into the caller's own profile from the archive the service staged, removes the trees its own receipts track that left the plan, and reports every result back. It runs as the user, never as SYSTEM, and is portable so it is tested on any host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sync ¶
func Sync(ctx context.Context, client Client, guard placement.Guard, receiptDir string, logger *slog.Logger) ([]service.UserPlacementResult, error)
Sync applies the service's user-placement plan for one user. guard holds the OS (harness.Windows), the compiled write roots, whose user-scope roots apply, the refused data and binary directories, and Vars["USERPROFILE"]. Receipts live in receiptDir. Held entries are neither placed nor removed. The trees' templates render with the plan's facts, each entry's managed flag and this account's login name; the helper runs no script of its own. Every result is logged and reported; the returned error is set only when the login name cannot be read or no plan could be fetched, after retrying a service that cannot be reached yet for up to a minute, in which case nothing is placed or removed.
Two syncs for one user at once (a logon and a storefront start) can trip over each other's staging directory; the loser logs a failed result and the next sync converges. A per-user lock is the upgrade if that shows up.