summaryrefslogtreecommitdiff
path: root/indra/viewer_components/updater
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-12-16 09:34:19 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-12-16 09:34:19 -0800
commit1774489ef8c224359e39d6281497e5128b043d24 (patch)
treece5ed7ab9092d2f6aa8cc9cb4080f22c71827a8f /indra/viewer_components/updater
parent6f996302ef5f8277dbfab9a75a536b554d7fa4e9 (diff)
Vary install failed message depending on whether it was required or not.
Diffstat (limited to 'indra/viewer_components/updater')
-rw-r--r--indra/viewer_components/updater/llupdateinstaller.cpp7
-rw-r--r--indra/viewer_components/updater/llupdateinstaller.h7
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp8
-rw-r--r--indra/viewer_components/updater/scripts/darwin/update_install2
-rw-r--r--indra/viewer_components/updater/scripts/linux/update_install2
-rw-r--r--indra/viewer_components/updater/scripts/windows/update_install.bat2
-rw-r--r--indra/viewer_components/updater/tests/llupdaterservice_test.cpp2
7 files changed, 22 insertions, 8 deletions
diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp
index 6e69bcf28b..fe1e493e82 100644
--- a/indra/viewer_components/updater/llupdateinstaller.cpp
+++ b/indra/viewer_components/updater/llupdateinstaller.cpp
@@ -25,6 +25,7 @@
#include "linden_common.h"
#include <apr_file_io.h>
+#include <boost/lexical_cast.hpp>
#include "llapr.h"
#include "llprocesslauncher.h"
#include "llupdateinstaller.h"
@@ -47,7 +48,10 @@ namespace {
}
-int ll_install_update(std::string const & script, std::string const & updatePath, LLInstallScriptMode mode)
+int ll_install_update(std::string const & script,
+ std::string const & updatePath,
+ bool required,
+ LLInstallScriptMode mode)
{
std::string actualScriptPath;
switch(mode) {
@@ -73,6 +77,7 @@ int ll_install_update(std::string const & script, std::string const & updatePath
launcher.setExecutable(actualScriptPath);
launcher.addArgument(updatePath);
launcher.addArgument(ll_install_failed_marker_path().c_str());
+ launcher.addArgument(boost::lexical_cast<std::string>(required));
int result = launcher.launch();
launcher.orphan();
diff --git a/indra/viewer_components/updater/llupdateinstaller.h b/indra/viewer_components/updater/llupdateinstaller.h
index 6ce08ce6fa..fe5b1d19b5 100644
--- a/indra/viewer_components/updater/llupdateinstaller.h
+++ b/indra/viewer_components/updater/llupdateinstaller.h
@@ -42,9 +42,10 @@ enum LLInstallScriptMode {
// that the current application terminate once this function is called.
//
int ll_install_update(
- std::string const & script, // Script to execute.
- std::string const & updatePath, // Path to update file.
- LLInstallScriptMode mode=LL_COPY_INSTALL_SCRIPT_TO_TEMP); // Run in place or copy to temp?
+ std::string const & script, // Script to execute.
+ std::string const & updatePath, // Path to update file.
+ bool required, // Is the update required.
+ LLInstallScriptMode mode=LL_COPY_INSTALL_SCRIPT_TO_TEMP); // Run in place or copy to temp?
//
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index df1a963f81..08f76c26e9 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -305,6 +305,7 @@ bool LLUpdaterServiceImpl::checkForInstall(bool launchInstaller)
int result = ll_install_update(install_script_path(),
update_info["path"].asString(),
+ update_info["required"].asBoolean(),
install_script_mode());
if((result == 0) && mAppExitCallback)
@@ -489,6 +490,12 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
// Check for failed install.
if(LLFile::isfile(ll_install_failed_marker_path()))
{
+ int requiredValue = 0;
+ {
+ llifstream stream(ll_install_failed_marker_path());
+ stream >> requiredValue;
+ if(!stream) requiredValue = 0;
+ }
// TODO: notify the user.
llinfos << "found marker " << ll_install_failed_marker_path() << llendl;
llinfos << "last install attempt failed" << llendl;
@@ -496,6 +503,7 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
LLSD event;
event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
+ event["required"] = LLSD(requiredValue);
LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);
setState(LLUpdaterService::TERMINAL);
diff --git a/indra/viewer_components/updater/scripts/darwin/update_install b/indra/viewer_components/updater/scripts/darwin/update_install
index 9df382f119..6a95f96d86 100644
--- a/indra/viewer_components/updater/scripts/darwin/update_install
+++ b/indra/viewer_components/updater/scripts/darwin/update_install
@@ -6,5 +6,5 @@
#
cd "$(dirname "$0")"
-../Resources/mac-updater.app/Contents/MacOS/mac-updater -dmg "$1" -name "Second Life Viewer 2" -marker "$2" &
+(../Resources/mac-updater.app/Contents/MacOS/mac-updater -dmg "$1" -name "Second Life Viewer 2"; if [ $? -ne 0 ]; then echo $3 >> "$2"; fi;) &
exit 0
diff --git a/indra/viewer_components/updater/scripts/linux/update_install b/indra/viewer_components/updater/scripts/linux/update_install
index a271926e25..88451340ec 100644
--- a/indra/viewer_components/updater/scripts/linux/update_install
+++ b/indra/viewer_components/updater/scripts/linux/update_install
@@ -4,7 +4,7 @@ export LD_LIBRARY_PATH="$INSTALL_DIR/lib"
bin/linux-updater.bin --file "$1" --dest "$INSTALL_DIR" --name "Second Life Viewer 2" --stringsdir "$INSTALL_DIR/skins/default/xui/en" --stringsfile "strings.xml"
if [ $? -ne 0 ]
- then touch "$2"
+ then echo $3 >> "$2"
fi
rm -f "$1"
diff --git a/indra/viewer_components/updater/scripts/windows/update_install.bat b/indra/viewer_components/updater/scripts/windows/update_install.bat
index 42e148a707..96687226a8 100644
--- a/indra/viewer_components/updater/scripts/windows/update_install.bat
+++ b/indra/viewer_components/updater/scripts/windows/update_install.bat
@@ -1,3 +1,3 @@
start /WAIT %1 /SKIP_DIALOGS
-IF ERRORLEVEL 1 ECHO %ERRORLEVEL% > %2
+IF ERRORLEVEL 1 ECHO %3 > %2
DEL %1
diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
index be5a5da50d..5f8cd28f29 100644
--- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
+++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
@@ -103,7 +103,7 @@ void LLUpdateDownloader::resume(void) {}
void LLUpdateDownloader::cancel(void) {}
void LLUpdateDownloader::setBandwidthLimit(U64 bytesPerSecond) {}
-int ll_install_update(std::string const &, std::string const &, LLInstallScriptMode)
+int ll_install_update(std::string const &, std::string const &, bool, LLInstallScriptMode)
{
return 0;
}