Skip to content

Check for Updates

Stable

Checking for updates is the first thing the Launcher does on every launch. It fetches the latest release manifest from the remote server, compares it against the locally installed manifest, applies an update if one is needed, and then starts the Daemon.

PropertyValue
Applies toLauncher
TriggerThe user starts the Launcher
PreconditionsThe Launcher is configured with a remote manifest URL and a remote archive URL

Inputs

There are no caller-provided inputs. The Launcher reads all necessary configuration from its environment at startup.

Assertions

AssertionStatus
The remote manifest URL must be reachableImplemented

Outputs

This behavior does not return a value. On failure to fetch the remote manifest, the Launcher prints an error and halts, prompting the user to press Enter before exiting.

Effects

EffectStatus
The remote manifest is fetched from the configured URLImplemented
If no local manifest exists, the update is applied as a fresh installImplemented
If the remote manifest's etag differs from the local manifest's etag, the update is appliedImplemented
If any file listed in the local manifest is missing from disk, the update is appliedImplemented
If an update is applied, the release archive is downloaded and extracted into a versioned folderImplemented
If an update is applied and a previous version folder exists, it is deleted after extraction completesImplemented
If an update is applied, the local manifest is overwritten with the remote manifestImplemented
The Daemon executable is spawned from the versioned release folder with DZ_DAEMON_DATABASE_PATH setImplemented

Behavior

mermaid
flowchart TD
    Start([Launcher starts]) --> Fetch[Fetch remote manifest]

    Fetch --> FetchOk{Fetch succeeded?}
    FetchOk -- No --> Halt([Halt: prompt user and exit])
    FetchOk -- Yes --> ReadLocal[Read local manifest from disk]

    ReadLocal --> LocalExists{Local manifest<br/>exists?}
    LocalExists -- No --> ApplyUpdate[Apply update]
    LocalExists -- Yes --> CompareEtag{etags match?}

    CompareEtag -- No --> ApplyUpdate
    CompareEtag -- Yes --> CheckFiles{All listed files<br/>exist on disk?}

    CheckFiles -- No --> ApplyUpdate
    CheckFiles -- Yes --> Launch[Start Daemon]

    ApplyUpdate --> Download[Download release archive]
    Download --> Extract[Extract files to versioned folder]
    Extract --> Cleanup{Previous version<br/>folder exists?}
    Cleanup -- Yes --> Delete[Delete previous version folder]
    Cleanup -- No --> WriteManifest[Write updated local manifest]
    Delete --> WriteManifest
    WriteManifest --> Launch

    Launch --> Done([Daemon running])

    style Halt fill:#f87171,color:#fff
    style Done fill:#4ade80,color:#000

See Also