Platform Update Scripts
OpenFrame Documentation
Get the most out of OpenFrame · Book 30 minutes with Conrad, 25 years in IT. He'll show you what Mingo and Fae can take off your list.
OpenFrame Documentation
Platform Update Scripts contains the operating-system-specific, external updater programs used by the OpenFrame Client self-update flow. The scripts are embedded in the openframe_agent_lib artifact from the OpenFrame OSS Library and are executed by the client distributed by this repository. Their narrow responsibility is to stop the installed client service, atomically replace its executable as far as the host permits, restart it, and verify that the newly started process reports the expected version.
The module deliberately performs the swap outside the process being replaced. It uses a staged binary, a pre-swap copy, and a last-known-good reserve so that a failed replacement can restore a runnable client.
The implementation is supplied by OpenFrame OSS Library version v0.0.5 as the Cargo dependency openframe_agent_lib. The client-update service reserves and launches an update, the updater-launcher selects and runs the platform script, and the scripts below perform the host-level handoff. The update-state, last-known-good, client-info, and update-handler services own the higher-level lifecycle and persisted state.
flowchart LR
UpdateService["Client Update Service"] -->|"reserves and applies update"| Launcher["Platform Updater Launcher"]
Launcher -->|"starts external updater"| Scripts["Platform Update Scripts"]
Scripts -->|"stops, swaps, and starts"| ClientService["OpenFrame Client Service"]
ClientService -->|"writes version marker"| BootMarker["Boot Marker"]
Scripts -->|"updates phase"| UpdateState["Update State"]
Scripts -->|"restores on failure"| Reserve["Last Known Good Reserve"]
Both implementations receive the staged executable, service identity, installed executable path, update-state path, expected version, boot-marker path, last-known-good path, and a boot-marker wait interval. The Windows script additionally accepts a transcript path. The boot marker is the decisive post-start check: a running service alone is not sufficient evidence that the intended binary started.
| Concern | Common behavior |
|---|---|
| Input validation | Requires the staged and target executables, checks that the staged binary is at least 100 KiB, and confirms that the service definition exists. |
| Controlled stop | Stops the service and waits up to 30 seconds, followed by a short settling delay. |
| Replacement | Moves the installed executable to a .prev path, copies the staged executable into the target path, and clears any old boot marker. |
| Success verification | Starts the service, confirms its running or loaded state, then waits for the marker to contain the requested version. |
| State reporting | Sets the persisted update phase to verifying after a successful boot-marker match. |
| Failure before swap | Marks the update as failed and attempts to restart the untouched service. |
| Failure after swap | Stops the service, restores the last-known-good reserve when present or the .prev copy otherwise, marks rolled_back before restart, and retries restoration up to three times. |
| Uninstall race | If the update state disappears during a normal update, the updater stands down rather than altering service state. |
The module has two platform-specific implementations:
bash, manages the client through launchctl, and is launched through a temporary LaunchDaemon property-list definition. Its property-list template forwards the updater arguments and sends both standard output and standard error to the supplied transcript path.Detailed platform notes are available in the generated submodules:
launchctl lifecycle, and file-mode handling.flowchart TD
Start["External updater starts"] --> Validate["Validate paths and staged binary size"]
Validate -->|"invalid"| PreSwapFailure["Mark failed and restart untouched service"]
Validate -->|"valid"| Stop["Stop client service"]
Stop -->|"timeout or error"| PreSwapFailure
Stop --> Move["Move installed executable to previous copy"]
Move --> Swap["Copy staged executable into target path"]
Swap --> StartService["Start client service"]
StartService --> Marker["Wait for matching boot marker"]
Marker -->|"matching version"| Verifying["Set phase to verifying and clean up"]
Marker -->|"missing or wrong version"| Rollback["Restore last known good or previous copy"]
Rollback --> Restart["Restart restored service"]
Restart --> RolledBack["Set phase to rolled back"]
verifying; final lifecycle handling remains the responsibility of the client update services.