Skip to content
Snippets Groups Projects
Commit 0f26013d authored by Mark Palange (Mani)'s avatar Mark Palange (Mani)
Browse files

Merge

parents bfa393f9 830afa5b
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,8 @@ void LLThread::shutdown() ...@@ -147,6 +147,8 @@ void LLThread::shutdown()
{ {
// This thread just wouldn't stop, even though we gave it time // This thread just wouldn't stop, even though we gave it time
llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl; llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl;
// Put a stake in its heart.
apr_thread_exit(mAPRThreadp, -1);
return; return;
} }
mAPRThreadp = NULL; mAPRThreadp = NULL;
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "linden_common.h" #include "linden_common.h"
#include <boost/format.hpp>
#include <libgen.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
...@@ -62,6 +65,7 @@ Boolean gCancelled = false; ...@@ -62,6 +65,7 @@ Boolean gCancelled = false;
const char *gUpdateURL; const char *gUpdateURL;
const char *gProductName; const char *gProductName;
const char *gBundleID; const char *gBundleID;
const char *gDmgFile;
void *updatethreadproc(void*); void *updatethreadproc(void*);
...@@ -334,6 +338,10 @@ int parse_args(int argc, char **argv) ...@@ -334,6 +338,10 @@ int parse_args(int argc, char **argv)
{ {
gBundleID = argv[j]; gBundleID = argv[j];
} }
else if ((!strcmp(argv[j], "-dmg")) && (++j < argc))
{
gDmgFile = argv[j];
}
} }
return 0; return 0;
...@@ -361,10 +369,11 @@ int main(int argc, char **argv) ...@@ -361,10 +369,11 @@ int main(int argc, char **argv)
gUpdateURL = NULL; gUpdateURL = NULL;
gProductName = NULL; gProductName = NULL;
gBundleID = NULL; gBundleID = NULL;
gDmgFile = NULL;
parse_args(argc, argv); parse_args(argc, argv);
if (!gUpdateURL) if ((gUpdateURL == NULL) && (gDmgFile == NULL))
{ {
llinfos << "Usage: mac_updater -url <url> [-name <product_name>] [-program <program_name>]" << llendl; llinfos << "Usage: mac_updater -url <url> | -dmg <dmg file> [-name <product_name>] [-program <program_name>]" << llendl;
exit(1); exit(1);
} }
else else
...@@ -700,10 +709,14 @@ static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) ...@@ -700,10 +709,14 @@ static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app)
// Looks promising. Check to see if it has the right bundle identifier. // Looks promising. Check to see if it has the right bundle identifier.
if(isFSRefViewerBundle(&ref)) if(isFSRefViewerBundle(&ref))
{ {
llinfos << name << " is the one" << llendl;
// This is the one. Return it. // This is the one. Return it.
*app = ref; *app = ref;
found = true; found = true;
} else {
llinfos << name << " is not the bundle we are looking for; move along" << llendl;
} }
} }
} }
} }
...@@ -921,6 +934,22 @@ void *updatethreadproc(void*) ...@@ -921,6 +934,22 @@ void *updatethreadproc(void*)
#endif // 0 *HACK for DEV-11935 #endif // 0 *HACK for DEV-11935
// Skip downloading the file if the dmg was passed on the command line.
std::string dmgName;
if(gDmgFile != NULL) {
dmgName = basename((char *)gDmgFile);
char * dmgDir = dirname((char *)gDmgFile);
strncpy(tempDir, dmgDir, sizeof(tempDir));
err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL);
if(err != noErr) throw 0;
chdir(tempDir);
goto begin_install;
} else {
// Continue on to download file.
dmgName = "SecondLife.dmg";
}
strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1);
if(mkdtemp(temp) == NULL) if(mkdtemp(temp) == NULL)
{ {
...@@ -979,14 +1008,17 @@ void *updatethreadproc(void*) ...@@ -979,14 +1008,17 @@ void *updatethreadproc(void*)
fclose(downloadFile); fclose(downloadFile);
downloadFile = NULL; downloadFile = NULL;
} }
begin_install:
sendProgress(0, 0, CFSTR("Mounting image...")); sendProgress(0, 0, CFSTR("Mounting image..."));
LLFile::mkdir("mnt", 0700); LLFile::mkdir("mnt", 0700);
// NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder,
// but if our cleanup fails, this makes it much harder for the user to unmount the image. // but if our cleanup fails, this makes it much harder for the user to unmount the image.
std::string mountOutput; std::string mountOutput;
FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */ boost::format cmdFormat("hdiutil attach %s -mountpoint mnt");
cmdFormat % dmgName;
FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */
if(mounter == NULL) if(mounter == NULL)
{ {
...@@ -1077,7 +1109,11 @@ void *updatethreadproc(void*) ...@@ -1077,7 +1109,11 @@ void *updatethreadproc(void*)
// Move aside old version (into work directory) // Move aside old version (into work directory)
err = FSMoveObject(&targetRef, &tempDirRef, &asideRef); err = FSMoveObject(&targetRef, &tempDirRef, &asideRef);
if(err != noErr) if(err != noErr)
{
llwarns << "failed to move aside old version (error code " <<
err << ")" << llendl;
throw 0; throw 0;
}
// Grab the path for later use. // Grab the path for later use.
err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside)); err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside));
...@@ -1175,6 +1211,10 @@ void *updatethreadproc(void*) ...@@ -1175,6 +1211,10 @@ void *updatethreadproc(void*)
llinfos << "Moving work directory to the trash." << llendl; llinfos << "Moving work directory to the trash." << llendl;
err = FSMoveObject(&tempDirRef, &trashFolderRef, NULL); err = FSMoveObject(&tempDirRef, &trashFolderRef, NULL);
if(err != noErr) {
llwarns << "failed to move files to trash, (error code " <<
err << ")" << llendl;
}
// snprintf(temp, sizeof(temp), "rm -rf '%s'", tempDir); // snprintf(temp, sizeof(temp), "rm -rf '%s'", tempDir);
// printf("%s\n", temp); // printf("%s\n", temp);
......
#! /bin/bash #! /bin/bash
hdiutil attach -nobrowse $1 open ../Resources/mac-updater.app --args -dmg "$1" -name "Second Life Viewer 2"
cp -R /Volumes/Second\ Life\ Installer/Second\ Life\ Viewer\ 2.app /Applications
hdiutil detach /Volumes/Second\ Life\ Installer
open /Applications/Second\ Life\ Viewer\ 2.app
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment