From 6e15957d909787ba612004903f04335a593b5348 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 09:40:30 -0800 Subject: run install script on successful download --- indra/newview/viewer_manifest.py | 10 ++++--- .../updater/llupdateinstaller.cpp | 13 +++++---- .../viewer_components/updater/llupdaterservice.cpp | 33 ++++++++++++++++++++-- .../updater/tests/llupdaterservice_test.cpp | 6 ++++ 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f95697adb6..0073641ed4 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -571,14 +571,16 @@ class DarwinManifest(ViewerManifest): # copy additional libs in /Contents/MacOS/ self.path("../../libraries/universal-darwin/lib_release/libndofdev.dylib", dst="MacOS/libndofdev.dylib") + + + if self.prefix(src="../viewer_components/updater", dst="MacOS"): + self.path("update_install") + self.end_prefix() + # most everything goes in the Resources directory if self.prefix(src="", dst="Resources"): super(DarwinManifest, self).construct() - - if self.prefix(src="../viewer_components/updater", dst=""): - self.path("update_install") - self.end_prefix() if self.prefix("cursors_mac"): self.path("*.tif") diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 52744b0479..10d5edc6a0 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -49,26 +49,29 @@ namespace { int ll_install_update(std::string const & script, std::string const & updatePath, LLInstallScriptMode mode) { - std::string finalPath; + std::string actualScriptPath; switch(mode) { case LL_COPY_INSTALL_SCRIPT_TO_TEMP: try { - finalPath = copy_to_temp(updatePath); + actualScriptPath = copy_to_temp(script); } catch (RelocateError &) { return -1; } break; case LL_RUN_INSTALL_SCRIPT_IN_PLACE: - finalPath = updatePath; + actualScriptPath = script; break; default: llassert(!"unpossible copy mode"); } + llinfos << "UpdateInstaller: installing " << updatePath << " using " << + actualScriptPath << LL_ENDL; + LLProcessLauncher launcher; - launcher.setExecutable(script); - launcher.addArgument(finalPath); + launcher.setExecutable(actualScriptPath); + launcher.addArgument(updatePath); int result = launcher.launch(); launcher.orphan(); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 466b27f6fe..43551d6cea 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -30,6 +30,7 @@ #include "lltimer.h" #include "llupdaterservice.h" #include "llupdatechecker.h" +#include "llupdateinstaller.h" #include #include @@ -52,6 +53,26 @@ namespace return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, UPDATE_MARKER_FILENAME); } + + std::string install_script_path(void) + { +#ifdef LL_WINDOWS + std::string scriptFile = "update_install.bat"; +#else + std::string scriptFile = "update_install"; +#endif + return gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, scriptFile); + } + + LLInstallScriptMode install_script_mode(void) + { +#ifdef LL_WINDOWS + return LL_COPY_INSTALL_SCRIPT_TO_TEMP; +#else + return LL_RUN_INSTALL_SCRIPT_IN_PLACE; +#endif + }; + } class LLUpdaterServiceImpl : @@ -218,11 +239,17 @@ bool LLUpdaterServiceImpl::checkForInstall() LLSD path = update_info.get("path"); if(path.isDefined() && !path.asString().empty()) { - // install! - - if(mAppExitCallback) + int result = ll_install_update(install_script_path(), + update_info["path"].asString(), + install_script_mode()); + + if((result == 0) && mAppExitCallback) { mAppExitCallback(); + } else if(result != 0) { + llwarns << "failed to run update install script" << LL_ENDL; + } else { + ; // No op. } } diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index aa30fa717d..9b56a04ff6 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -30,6 +30,7 @@ #include "../llupdaterservice.h" #include "../llupdatechecker.h" #include "../llupdatedownloader.h" +#include "../llupdateinstaller.h" #include "../../../test/lltut.h" //#define DEBUG_ON @@ -100,6 +101,11 @@ std::string LLUpdateDownloader::downloadMarkerPath(void) void LLUpdateDownloader::resume(void) {} +int ll_install_update(std::string const &, std::string const &, LLInstallScriptMode) +{ + return 0; +} + /* #pragma warning(disable: 4273) llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, -- cgit v1.2.3