diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-19 16:50:42 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-19 20:24:32 +0100 |
commit | 958a055be8d58137e1a32c5cd18f67d1aab3012d (patch) | |
tree | ba9c1a34bda1bcd43032b8466313956605d107a9 /desktop | |
parent | bbb7c3eeccef61ec0c4c8332296705e96f0e6538 (diff) |
Improve --enable-online-update-mar Windows MOZ_MAINTENANCE_SERVICE feature
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>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/updater.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 925b6b7116a4..3221d688a47f 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -32,6 +32,7 @@ #include <osl/file.hxx> #include <rtl/process.h> #include <sal/log.hxx> +#include <tools/stream.hxx> #include <curl/curl.h> @@ -173,17 +174,14 @@ void createStr(const OUString& rStr, CharT** pArgs, size_t i) pArgs[i] = pStr; } -CharT** createCommandLine(int * argc) +CharT** createCommandLine(OUString const & argv0, int * argc) { OUString aInstallDir = Updater::getInstallationPath(); size_t nCommandLineArgs = rtl_getAppCommandArgCount(); size_t nArgs = 8 + nCommandLineArgs; CharT** pArgs = new CharT*[nArgs]; - { - OUString aUpdaterName = OUString::fromUtf8(pUpdaterName); - createStr(aUpdaterName, pArgs, 0); - } + createStr(argv0, pArgs, 0); { // directory with the patch log OUString aPatchDir = Updater::getPatchDirURL(); @@ -307,7 +305,7 @@ bool update() Updater::log("Calling the updater with parameters: "); int argc; - CharT** pArgs = createCommandLine(&argc); + CharT** pArgs = createCommandLine(aUpdaterPath, &argc); bool bSuccess = true; const char* pUpdaterTestReplace = std::getenv("LIBO_UPDATER_TEST_REPLACE"); @@ -676,9 +674,11 @@ void download_file(const OUString& rURL, size_t nFileSize, const OUString& rHash throw invalid_hash(rHash, aHash); } - OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/"); + OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/"); rtl::Bootstrap::expandMacros(aPatchDirURL); osl::Directory::create(aPatchDirURL); + aPatchDirURL += "0/"; + osl::Directory::create(aPatchDirURL); OUString aDestFile = aPatchDirURL + aFileName; Updater::log("Destination File: " + aDestFile); @@ -764,6 +764,14 @@ void update_checker() comphelper::ConfigurationChanges::create()); officecfg::Office::Update::Update::SeeAlso::set(aSeeAlsoURL, batch); batch->commit(); + OUString const statUrl = Updater::getPatchDirURL() + "update.status"; + SvFileStream stat(statUrl, StreamMode::WRITE | StreamMode::TRUNC); + stat.WriteOString("pending-service"); + stat.Flush(); + if (auto const e = stat.GetError()) { + Updater::log("Writing <" + statUrl + "> failed with " + e.toString()); + } + stat.Close(); } } } @@ -796,7 +804,7 @@ void update_checker() OUString Updater::getUpdateInfoLog() { - OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/updating.log"); + OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/updating.log"); rtl::Bootstrap::expandMacros(aUpdateInfoURL); return aUpdateInfoURL; @@ -804,7 +812,7 @@ OUString Updater::getUpdateInfoLog() OUString Updater::getPatchDirURL() { - OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/"); + OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/0/"); rtl::Bootstrap::expandMacros(aPatchDirURL); return aPatchDirURL; |