office-gobmx/onlineupdate
Stephan Bergmann 13595f6220 Fix --enable-online-update-mar on Windows
The code had apparently rotten a bit,

* a wchar_t vs. char16_t confusion in desktop/source/app/updater.cxx

* code broken by 926e4e469d "Rename online updater
  functions and strcmp relpath" in
  onlineupdate/source/update/updater/updater.cxx

* -DUNICODE missing in some places (so that plain Windows functions resolve to
  the ...W variant), which had been set centrally in the past IIRC

* silencing some warnings like "C4267: 'initializing': conversion from 'size_t'
  to 'int', possible loss of data" (where silencing is the right thing to do for
  effectively extern code); no sure why those apparently didn't hit in the past,
  maybe it is all warnings that compilers only started to emit in recent years,
  or only for recent -std:c++... modes

* silencing some "Conversion from string literal loses const qualifier" errors
  with -Zc:strictStrings-; these hit at least with recent VS 2022 Preview and
  --with-latest-c++, where -Zc:strictStrings is apparently now on by default

Change-Id: I7fe46f5aa2b42fc9c03f24f7f0236512b4d3b936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160451
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-08 09:49:41 +01:00
..
inc
qa
source
workben
astyle.options
CustomTarget_generated.mk
Executable_mar.mk
Executable_mbsdiff.mk
Executable_test_updater_dialog.mk
Executable_update_service.mk
Executable_updater.mk
Makefile
Module_onlineupdate.mk
README.md
StaticLibrary_libmar.mk
StaticLibrary_libmarverify.mk
StaticLibrary_updatehelper.mk
WinResTarget_updater.mk

Online Update

Online update implementation based on Mozilla's MAR format + update mechanism

Parts of this code are copied from the mozilla repository, and adapted to LibreOffice needs:

firefox/modules/libmar -> onlineupdate/source/libmar firefox/toolkit/mozapps/update -> onlineupdate/source/update

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.