To get the MOZ_MAINTENANCE_SERVICE mode going at all, update.status needs to contain a "pending-service" token. For Mozilla, code in its toolkit/mozapps/update/UpdateService.sys.mjs takes care of writing that. For us, lets always write that in update_checker() (even on Linux, where it's apparently harmless). Then, the MOZ_MAINTENANCE_SERVICE code is rather picky with its various sanity checks: Among other things, it expects argv[0] to be a full path to the updater executable, and it expects the update.mar (and its status and log files) to be in a directory hierarchy named updates/0/ rather than patch/. So get all that fixed in desktop/source/app/updater.cxx. And patch in external/onlineupdate/lo.patch where it expects to find the updater executable (just updater.exe vs. our program/updater.exe). And we shouldn't interfere with the upstream Mozilla maintenance service, so also rename that in external/onlineupdate/lo.patch. And `update_service install` wants to read version resources from the update_service.exe, so provide that (via gb_Executable_add_default_nativeres). Also, `update_service install` wants to read a MozillaMaintenanceDescription value from an updater.ini, so provide one (with contents of that value inspired by Mozilla's browser/locales/en-US/updater/updater.ini). As we now have an updater.ini anyway (and which apparently works fine with Unix line ends on both Linux and Windows), also use it on Linux and drop the onlineupdate/source/update/updater/progressui_gtk.cpp again from external/onlineupdate/lo.patch. And update external/onlineupdate/README.md how to manually execute that test against an updater.ini. Change-Id: I0e3e5e5311be61e1224cda700af2e5d751113a99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160996 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
1.9 KiB
Online Update
Online update implementation based on Mozilla's MAR format + update mechanism
The source code has been extracted from https://github.com/mozilla/gecko-dev with external/onlineupdate/generate-sources.sh.
The source/service directory contains the code for the silent windows updater that avoids the repeated administrator check for an update.
Note
The updater executable should not depend on any other dynamic library in the LibreOffice installation as we would need to copy that one also to a temporary directory during update. We can't update any library or executable that is currently in use. For the updater executable we solve this problem by copying the updater before using it to a temporary directory.
On Windows we use the system to provide us with a crypto library whereas on Linux we use NSS.
Update Procedure
The updater executable is run two times. In a first run, the current installation is copied to an
update
directory and the update is applied in this update
directory. During the next run, a
replacement request is executed. The replacement request removes the old installation directory and
replaces it with the content of the update
directory.
User Profile in the Installation Directory
The archive based installations have the user profile by default inside of the installation directory. During the update process this causes some problems that need special handling in the updater.
- The
update
directory is inside of the user profile resulting in recursive copying. - During the replacement request the updater log is in the user profile, which changes location from the actual location to a backup location.
Executable_test_updater_dialog
To run that manual test, do
$ cp instdir/program/updater.ini workdir/LinkTarget/Executable/test_updater_dialog.ini
$ workdir/LinkTarget/Executable/test_updater_dialog
$ rm workdir/LinkTarget/Executable/test_updater_dialog.ini