Updates
GView checks GitHub Releases for a newer version once a day and offers to install it.
How it works for the user
The first time GView starts on a given day, it asks GitHub in the background whether a newer release exists. Nothing is shown when GView is up to date, offline, or when the check fails.
The first time a newer version is found, GView shows the Update available dialog with the installed and the new version, the publish date, the download size and the release notes. The dialog waits until no other dialog is open.
Install update downloads and verifies the release, then asks for a final confirmation. GView closes, replaces its files and restarts in the same terminal with the same command line.
Remind me later (or closing the dialog) hides the prompt for that version for
UpdateRemindAfterDaysdays.Skip this version never prompts for that version again. A newer version is offered normally.
Copy link copies the release page link to the clipboard.
“Remind me later” is the default button, and Enter alone never installs. When the dialog opens by itself, its buttons ignore input for one second, so keystrokes meant for a viewer cannot answer it.
Help > Check for updates runs the same check on demand. It also offers a version that was skipped or postponed.
Updates are not offered while Learning and Evaluation Mode is active, because an update would end the session.
How an update is installed
GView downloads the release archive of the current operating system into
<GView folder>/.update/and checks its SHA-256 against theSHA256SUMSfile published with the release. The archive is validated (no absolute paths,.., links, device names, duplicates, encrypted entries or oversized entries) and extracted to.update/staging-<version>/. The installation itself is not modified yet.After the confirmation GView closes its interface. It copies
GViewUpdaterto a private temporary folder and runs it.GViewUpdatervalidates the staged files, then replaces each file of the installation by renaming the current file into.update/old-<version>/and the staged file into its place. Every move is written to a journal. If a move fails, the journal is replayed backwards and the installation is left exactly as it was.GView waits for
GViewUpdater, then starts the new GView with the original command line and waits for it.The next start of GView removes the backup folder.
Files that are not part of the release are never touched: GView.ini, themes and plugins you added stay in place.
If the update fails and cannot be rolled back, GView prints the location of the backup folder and of the journal. The
previous files can be copied back from there by hand.
GViewUpdater has no dependency on the GView libraries, so it keeps working while they are being replaced. It is not
meant to be started manually.
Configuration
The updater reads these keys from the [GView] section of GView.ini:
Key |
Default |
Meaning |
|---|---|---|
|
|
Daily background check. |
|
|
Also offer releases marked as pre-release on GitHub. Every GView release so far is a pre-release. |
|
|
GitHub “list releases” API URL. Only |
|
|
Minimum delay between two automatic checks (1 to 720). |
|
|
Delay of “Remind me later”. |
|
empty |
Proxy for the update requests. |
GView also stores its own state there: UpdateLastCheck, UpdateLastSeenVersion, UpdateRemindAt,
UpdateSkippedVersion, UpdateETag and UpdateCachedFeedVersion. Deleting them resets the update prompts.
Limitations
GView must be able to write to its own folder. When it cannot (for example under
Program Filesor/opt), the dialog only offers to copy the release link and the update has to be installed manually.On Linux and macOS, the automatic check runs only with frontends that deliver frame updates (SDL). The terminal (ncurses) frontend of the current AppCUI version does not, so only Help > Check for updates is available there.
A release without
SHA256SUMScannot be installed automatically; download it from the release page instead.
Testing with a local server
Builds configured with -DDISSASM_DEV=1 accept an http:// feed and releases without a checksum list, so the whole
flow can be tested against a local web server:
Build GView twice: an “old” build with a lower
GVIEW_VERSIONand a “new” build.Zip the
bin/<Config>folder of the new build (the archive root is the content ofbin/<Config>, like the release archives), computesha256sumintoSHA256SUMSand write areleases.jsonthat copies the GitHub format (tag_name,draft,prerelease,html_url,body,published_atandassetswithname,sizeandbrowser_download_url).Serve the folder with
python -m http.server 8080and setUpdateFeedUrl = "http://127.0.0.1:8080/releases.json"andUpdateLastCheck = 0in the old build’sGView.ini.Start the old build. The dialog appears after the first frame; Help > Check for updates works as well.
In these development builds only, setting the environment variable GVIEW_UPDATE_TEST_AUTOACCEPT=1 answers
Install update and the final confirmation automatically, so the download, install and restart can be tested without
a keyboard. The variable is inherited by the restarted GView. Release builds ignore it.