summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/linux_updater/linux_updater.cpp149
-rw-r--r--indra/newview/viewer_manifest.py13
-rw-r--r--indra/viewer_components/updater/CMakeLists.txt22
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp6
-rwxr-xr-xindra/viewer_components/updater/scripts/linux/update_install5
5 files changed, 96 insertions, 99 deletions
diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp
index be4d810860..16660de6bb 100644
--- a/indra/linux_updater/linux_updater.cpp
+++ b/indra/linux_updater/linux_updater.cpp
@@ -49,6 +49,7 @@ const guint ROTATE_IMAGE_TIMEOUT = 8000;
typedef struct _updater_app_state {
std::string app_name;
std::string url;
+ std::string file;
std::string image_dir;
std::string dest_dir;
std::string strings_dirs;
@@ -266,85 +267,95 @@ gpointer worker_thread_cb(gpointer data)
CURLcode result;
FILE *package_file;
GError *error = NULL;
- char *tmp_filename = NULL;
int fd;
//g_return_val_if_fail (data != NULL, NULL);
app_state = (UpdaterAppState *) data;
try {
- // create temporary file to store the package.
- fd = g_file_open_tmp
- ("secondlife-update-XXXXXX", &tmp_filename, &error);
- if (error != NULL)
- {
- llerrs << "Unable to create temporary file: "
- << error->message
- << llendl;
- g_error_free(error);
- throw 0;
- }
-
- package_file = fdopen(fd, "wb");
- if (package_file == NULL)
+ if(!app_state->url.empty())
{
- llerrs << "Failed to create temporary file: "
- << tmp_filename
- << llendl;
+ char* tmp_local_filename = NULL;
+ // create temporary file to store the package.
+ fd = g_file_open_tmp
+ ("secondlife-update-XXXXXX", &tmp_local_filename, &error);
+ if (error != NULL)
+ {
+ llerrs << "Unable to create temporary file: "
+ << error->message
+ << llendl;
- gdk_threads_enter();
- display_error(app_state->window,
- LLTrans::getString("UpdaterFailDownloadTitle"),
- LLTrans::getString("UpdaterFailUpdateDescriptive"));
- gdk_threads_leave();
- throw 0;
- }
+ g_error_free(error);
+ throw 0;
+ }
+
+ if(tmp_local_filename != NULL)
+ {
+ app_state->file = tmp_local_filename;
+ g_free(tmp_local_filename);
+ }
- // initialize curl and start downloading the package
- llinfos << "Downloading package: " << app_state->url << llendl;
+ package_file = fdopen(fd, "wb");
+ if (package_file == NULL)
+ {
+ llerrs << "Failed to create temporary file: "
+ << app_state->file.c_str()
+ << llendl;
+
+ gdk_threads_enter();
+ display_error(app_state->window,
+ LLTrans::getString("UpdaterFailDownloadTitle"),
+ LLTrans::getString("UpdaterFailUpdateDescriptive"));
+ gdk_threads_leave();
+ throw 0;
+ }
- curl = curl_easy_init();
- if (curl == NULL)
- {
- llerrs << "Failed to initialize libcurl" << llendl;
+ // initialize curl and start downloading the package
+ llinfos << "Downloading package: " << app_state->url << llendl;
- gdk_threads_enter();
- display_error(app_state->window,
- LLTrans::getString("UpdaterFailDownloadTitle"),
- LLTrans::getString("UpdaterFailUpdateDescriptive"));
- gdk_threads_leave();
- throw 0;
- }
+ curl = curl_easy_init();
+ if (curl == NULL)
+ {
+ llerrs << "Failed to initialize libcurl" << llendl;
+
+ gdk_threads_enter();
+ display_error(app_state->window,
+ LLTrans::getString("UpdaterFailDownloadTitle"),
+ LLTrans::getString("UpdaterFailUpdateDescriptive"));
+ gdk_threads_leave();
+ throw 0;
+ }
- curl_easy_setopt(curl, CURLOPT_URL, app_state->url.c_str());
- curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE);
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, package_file);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
- curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
- &download_progress_cb);
- curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, app_state);
+ curl_easy_setopt(curl, CURLOPT_URL, app_state->url.c_str());
+ curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE);
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE);
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, package_file);
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
+ &download_progress_cb);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, app_state);
- result = curl_easy_perform(curl);
- fclose(package_file);
- curl_easy_cleanup(curl);
+ result = curl_easy_perform(curl);
+ fclose(package_file);
+ curl_easy_cleanup(curl);
- if (result)
- {
- llerrs << "Failed to download update: "
- << app_state->url
- << llendl;
+ if (result)
+ {
+ llerrs << "Failed to download update: "
+ << app_state->url
+ << llendl;
- gdk_threads_enter();
- display_error(app_state->window,
- LLTrans::getString("UpdaterFailDownloadTitle"),
- LLTrans::getString("UpdaterFailUpdateDescriptive"));
- gdk_threads_leave();
+ gdk_threads_enter();
+ display_error(app_state->window,
+ LLTrans::getString("UpdaterFailDownloadTitle"),
+ LLTrans::getString("UpdaterFailUpdateDescriptive"));
+ gdk_threads_leave();
- throw 0;
+ throw 0;
+ }
}
-
+
// now pulse the progres bar back and forth while the package is
// being unpacked
gdk_threads_enter();
@@ -357,7 +368,7 @@ gpointer worker_thread_cb(gpointer data)
// *TODO: if the destination is not writable, terminate this
// thread and show file chooser?
- if (!install_package(tmp_filename, app_state->dest_dir))
+ if (!install_package(app_state->file.c_str(), app_state->dest_dir))
{
llwarns << "Failed to install package to destination: "
<< app_state->dest_dir
@@ -393,11 +404,11 @@ gpointer worker_thread_cb(gpointer data)
}
// FIXME: delete package file also if delete-event is raised on window
- if (tmp_filename != NULL)
+ if(!app_state->url.empty() && !app_state->file.empty())
{
- if (gDirUtilp->fileExists(tmp_filename))
+ if (gDirUtilp->fileExists(app_state->file))
{
- LLFile::remove(tmp_filename);
+ LLFile::remove(app_state->file);
}
}
@@ -712,7 +723,7 @@ BOOL spawn_viewer(UpdaterAppState *app_state)
void show_usage_and_exit()
{
- std::cout << "Usage: linux-updater --url URL --name NAME --dest PATH --stringsdir PATH1,PATH2 --stringsfile FILE"
+ std::cout << "Usage: linux-updater <--url URL | --file FILE> --name NAME --dest PATH --stringsdir PATH1,PATH2 --stringsfile FILE"
<< "[--image-dir PATH]"
<< std::endl;
exit(1);
@@ -728,6 +739,10 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
{
app_state->url = argv[i];
}
+ else if ((!strcmp(argv[i], "--file")) && (++i < argc))
+ {
+ app_state->file = argv[i];
+ }
else if ((!strcmp(argv[i], "--name")) && (++i < argc))
{
app_state->app_name = argv[i];
@@ -756,7 +771,7 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
}
if (app_state->app_name.empty()
- || app_state->url.empty()
+ || (app_state->url.empty() && app_state->file.empty())
|| app_state->dest_dir.empty())
{
show_usage_and_exit();
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 55d64fd3a6..5d35778e3e 100644
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -247,13 +247,12 @@ class WindowsManifest(ViewerManifest):
self.disable_manifest_check()
+ self.path("../viewer_components/updater/scripts/windows/update_install.bat")
+
# Get shared libs from the shared libs staging directory
if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
dst=""):
- if self.prefix(src="../../viewer_components/updater", dst=""):
- self.path("update_install.bat")
- self.end_prefix()
self.enable_crt_manifest_check()
@@ -575,12 +574,8 @@ 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()
+ self.path("../viewer_components/updater/scripts/darwin/update_install", "MacOS/update_install")
# most everything goes in the Resources directory
if self.prefix(src="", dst="Resources"):
@@ -857,6 +852,8 @@ class LinuxManifest(ViewerManifest):
# recurse
self.end_prefix("res-sdl")
+ self.path("../viewer_components/updater/scripts/linux/update_install", "bin/update_install")
+
# plugins
if self.prefix(src="", dst="bin/llplugin"):
self.path("../media_plugins/webkit/libmedia_plugin_webkit.so", "libmedia_plugin_webkit.so")
diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt
index 469c0cf05e..0e288bb496 100644
--- a/indra/viewer_components/updater/CMakeLists.txt
+++ b/indra/viewer_components/updater/CMakeLists.txt
@@ -80,25 +80,3 @@ set(UPDATER_LIBRARIES
llupdaterservice
CACHE INTERNAL ""
)
-
-# Copy install script.
-if(DARWIN)
- copy_if_different(
- "${CMAKE_CURRENT_SOURCE_DIR}/scripts/darwin"
- "${CMAKE_CURRENT_BINARY_DIR}"
- update_installer_targets
- "update_install"
- )
-elseif(WINDOWS)
- copy_if_different(
- "${CMAKE_CURRENT_SOURCE_DIR}/scripts/windows"
- "${CMAKE_CURRENT_BINARY_DIR}"
- update_installer_targets
- "update_install.bat"
- )
-endif()
-add_custom_target(copy_update_install ALL DEPENDS ${update_installer_targets})
-add_dependencies(llupdaterservice copy_update_install)
-
-
- \ No newline at end of file
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index a1ad3e3381..976e639098 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -353,9 +353,11 @@ void LLUpdaterServiceImpl::downloadComplete(LLSD const & data)
void LLUpdaterServiceImpl::downloadError(std::string const & message)
{
+ LL_INFOS("UpdaterService") << "Error downloading: " << message << LL_ENDL;
+
mIsDownloading = false;
- // Restart the
+ // Restart the timer on error
if(mIsChecking)
{
restartTimer(mCheckPeriod);
@@ -365,7 +367,7 @@ void LLUpdaterServiceImpl::downloadError(std::string const & message)
void LLUpdaterServiceImpl::restartTimer(unsigned int seconds)
{
LL_INFOS("UpdaterService") << "will check for update again in " <<
- mCheckPeriod << " seconds" << LL_ENDL;
+ seconds << " seconds" << LL_ENDL;
mTimer.start();
mTimer.setTimerExpirySec(seconds);
LLEventPumps::instance().obtain("mainloop").listen(
diff --git a/indra/viewer_components/updater/scripts/linux/update_install b/indra/viewer_components/updater/scripts/linux/update_install
new file mode 100755
index 0000000000..acedaad25c
--- /dev/null
+++ b/indra/viewer_components/updater/scripts/linux/update_install
@@ -0,0 +1,5 @@
+#! /bin/bash
+INSTALL_DIR=$(cd "$(dirname $0)/.." ; pwd)
+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"
+