Updater
This document outlines the architectural design for a C++ updater responsible for downloading and executing the installers for the CLI and Server binaries.
Overview
The updater is designed to check for available updates, download the necessary installer files, and execute them to update the CLI and Server binaries.
Components
1. Version Management Module
- Purpose: Responsible for checking the current version of the installed binaries and determining if updates are available.
- Responsibilities:
- Retrieve the current version from local installations.
- Fetch information regarding the latest version from a remote source and save such info in
.cortexrc
. - Determine if an update is necessary based on version comparison.
2. Installer Download Manager
- Purpose: Handles downloading the installer files from specified URLs.
- Responsibilities:
- Manage HTTP requests to fetch installer files.
- Handle errors during download.
- Save downloaded installers in a temporary directory.
3. Installer Execution Module
- Purpose: Executes the downloaded installer files to perform updates.
- Responsibilities:
- Launch the installer with appropriate command-line arguments.
- Monitor the installation process and capture any output or errors.
- Ensure that installation completes successfully before proceeding.
4. User Interface (CLI)
- Purpose: Provides a command-line interface for users to initiate updates and view status messages.
- Responsibilities:
- Display current version information for CLI and Server:
cortex -v
- Inform users about available updates and progress during downloading and installation.
- Handle user input for initiating updates:
(sudo) cortex update
- Display current version information for CLI and Server:
Workflow
-
Initialization:
- The updater starts and initializes all necessary modules.
-
Version Check:
- The Version Management Module retrieves the current versions of both CLI and Server from local installations.
- It fetches the latest version information from a remote source.
-
Update Decision:
- If newer versions are available, the updater proceeds to download the installers; otherwise, it informs the user that no updates are necessary.
-
Download Process:
- The Installer Download Manager downloads the latest installer files using HTTP requests.
- Progress is reported back to the User Interface.
-
Installer Execution:
- Once downloaded, the Installer Execution Module runs the installer with silent mode.
- It monitors the installation process, capturing any output or errors.
-
Completion Notification:
- After successful installation, the User Interface notifies users of completion or any issues encountered during installation.
- Logs are updated with relevant information about the update process.