summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-11-11 09:40:30 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-11-11 09:40:30 -0800
commit6e15957d909787ba612004903f04335a593b5348 (patch)
tree0e1272efc57502ca05a35be31ceb8fdb0eed5b95
parent41517715844c986aab169502c94f39a9f507eb55 (diff)
run install script on successful download
-rw-r--r--indra/newview/viewer_manifest.py10
-rw-r--r--indra/viewer_components/updater/llupdateinstaller.cpp13
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp33
-rw-r--r--indra/viewer_components/updater/tests/llupdaterservice_test.cpp6
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 <bundle>/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 <boost/scoped_ptr.hpp>
#include <boost/weak_ptr.hpp>
@@ -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,