Skip to content

Self-update: in-place binary swap + relaunch on desktop (Windows/macOS/Linux) #87

Description

@krazyjakee

Part of the Godot→Flutter migration (#79). Needed for a true hands-off auto-updater.

Current state

The in-app updater (lib/features/updates/) only checks for releases and links the user to the matching platform asset to download + install by hand. In-place install is explicitly deferred:

"In-place self-replacement (binary swap + relaunch on desktop, APK install on Android) is intentionally deferred — it needs untestable per-platform native machinery." — lib/features/updates/controllers/update_controller.dart:75-78

What's needed

Implement download → verify → replace running binary → relaunch, per desktop platform:

  • Windows — running .exe/DLLs are locked; replacement must be delegated to a helper (batch/sidecar) that waits for exit, copies the new bundle, relaunches. Source artifact: daccord-windows-x86_64.zip (multi-file Flutter bundle — must copy the whole tree, incl. data/).
  • macOS — replace the .app bundle (cp -R), strip quarantine (xattr -cr) so Gatekeeper doesn't block, relaunch from new bundle. Artifact: daccord-macos-universal.dmg.
  • Linux — replace the bundle tree, restore exec bit (chmod +x), relaunch. Artifact: daccord-linux-x86_64.tar.gz.
  • Roll-back on failure (rename-to-.old then restore).
  • Integrity check on the downloaded archive before swapping.

Reference

The Godot client already does exactly this in ../daccord/scripts/autoload/updater.gd (_apply_binary_update, _apply_windows_update, _apply_macos_update) — use it as a spec. Note: its copy step is flat-file-only and would drop Flutter's subdirectories — the Flutter version must copy the full bundle tree.

Acceptance

A user on an old build clicks "Update", and the app downloads, replaces itself, and relaunches into the new version on all three desktop platforms, with no manual file handling.


Migrated from DaccordProject/daccord-app#80

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions