A library used for self update of client programs, and also its server side program.
- Client SDK
- New version query
- Resumable package downloading
- Install and delete self
- Server
- Listen to a port or a unix socket file
- HTTP service
- Flexible policy configuration
- Run
srcdepif srcdep is installed, or runfetch_depsinstead, to fetch dependencies. - Run
gn gen outandninja -C outto build this project. - Run
python src/sample/run_server.py outto test.
- Client: Client will query new version and download package. If ready, it will copy the Installer to a temporary directory and launches Installer.
- Installer: When the Installer is running, it will first wait for the Client process to exit. Then it install the new package (currently just unpack the package file), delete itself and launch the new Client.
- Server: Provide update info and package file downloading.
The Client and Installer could be either separated executeable, or merged together. The src/sample uses merged form.
- Include
src/include/selfupdate.h - Call
selfupdate::Queryto query new version and process the result.- The parameter
query_urlis in form ofhttp(s)://server.domain/packageName/clientVersion. - The parameter
query_bodyshould be empty for our server implement. - The result field
PackageInfo.has_new_versionindicates whether there is a suitable new version for the current version of the client. - If the result field
PackageInfo.forceis true, the Client is expected to do a force upgrade.
- The parameter
- Call
selfupdate::Downloadto download package.- The parameter
download_progress_monitorenables Client to show a visible progress to users.
- The parameter
- When downloading accomplished, Call
selfupdate::Installat a proper time, to perform the upgrade.- If the Installer is separated from the Client, pass the path of the Installer through
installer_path. - If the main executable of Client is not in the root directory of the application, pass root directory through
install_location
- If the Installer is separated from the Client, pass the path of the Installer through
- Include
src/include/installer.h - Call
selfupdate::IsInstallModeto check commaned line. If the Installer is merged with the Client, use this function to check whether it it running normally or installing. - Call
selfupdate::DoInstallto perform the install progress.
- Listening
- Listening to a local port by command line arguments
--portif it providing HTTP service directly. - Listening to a sock file by command line arguments
--sockif it acts as an upstream of other web server.
- Listening to a local port by command line arguments
- Configuration
- Pass root directory of configuration files by command line arguments
--config. Each.yamlor.ymlfile will be read inside the configuration directory, recursively. - Configuration file sample: src/server/config/sample_config.yaml
- Pass root directory of configuration files by command line arguments
- If
--rootis specified, the server will support file downloading inside the root directory. The package file could be provided in this way, if there is no other file service.