![]() |
Notification and download of updates | ![]() |
Since svn revision 7196, TeXmacs supports automatic notification of available downloads from a repository and their installation using the Sparkle framework for MacOS and WinSparkle under Windows.
In order to guarantee the origin of releases, these must be signed with a DSA key, whose public part will be bundled with the application. On the server side a so-called appcast must be updated for each release. It is an XML file containing information about available downloads, their contents and their digital signatures, following the specification for Sparkle/WinSparkle. For the moment we refer to Sparkle's documentation for more details.
In principle it should be easy for anyone to release their custom versions of TeXmacs and let their users autoupdate them. For this they only need to provide the public key and the URL of the appcast (using the --with-appcast configuration option, see below).
Under MacOS the process of creation of the appcast is partially automated through the make build rule MACOS_RELEASE. Calling make MACOS_RELEASE will compile and bundle TeXmacs, then zip and finally digitally sign the resulting .zip archive of the bundle with the script
misc/admin/sign_update
. In order for this to work, one has to set the environment variable TEXMACS_PRIVATE_DSA to point to the location of the private DSA key used to sign releases. At the end of the build process a chunk of XML is printed that can be pasted in the appcast.xml file. This rule is only provided by the autotools build (
Makefile.in
), not by the CMake build.
Under Windows digital signatures are not yet supported by WinSparkle and as such will be ignored (Aug. 2013).
There is no support for automatic notification of releases under Linux yet. Automatic download and installation is unlikely to happen due to the way packaging systems work for most distributions.
The C++ side of the updater lives in
src/src/Plugins/Updater/
: the abstract class tm_updater (
tm_updater.hpp
) has the implementations tm_sparkle (MacOS) and tm_winsparkle (Windows). Support is only compiled in when TeXmacs is configured with --with-sparkle; the URL of the appcast is fixed at configuration time using --with-appcast=url (see
misc/m4/sparkle.m4
), and is stored as SUFeedURL in the MacOS bundle's Info.plist, resp. in the Windows resource file. The following glued routines are available from Scheme:
Returns #t if TeXmacs was compiled with support for Sparkle or WinSparkle. All other routines do nothing and return #f (or zero) otherwise.
Start a background check for updates. A dialog box pops up only if there is an update. Returns #f if the check could not be started (for instance, because a check is already running, or, under Windows, because automatic checks are disabled).
Start a check for updates immediately, popping up a dialog with the progress. This call is non-blocking, since Sparkle and WinSparkle run in separate threads.
Sets the interval in hours to wait between automatic checks. The value is clamped between 24 hours and 31 days; under Windows, a value of zero disables automatic checks. Note that this does not alter the value of the preference "updater:interval", whose use is preferred.
(updater-running?)
Test whether a check is currently in progress, resp. return the time of the last check (in seconds since the epoch, or zero if there was no check yet).
At startup,
init-texmacs.scm
loads the module
utils/misc/updater.scm
if (updater-supported?) holds, and calls (updater-initialize) after a short delay. This routine reads the following preference:
The number of hours between automatic checks, as a string. Its default value "null" means that automatic checks are disabled. If the value is a number, then updater-initialize calls updater-set-interval with this value and starts a background check. In the preferences dialog (Edit\(\rightarrow\)Preferences\(\rightarrow\)Other), the possible choices are "0" (never), "24", "168" and "720" (once a day, week or month).
The older interface (check-updates-background, check-updates-foreground, check-updates-interval and the preferences "updater:appcast", "updater:automatic-checks", "updater:check-interval" and "updater:public-dsa-key") no longer exists.