Пример #1
0
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
	if(mTimer.getStarted() && mTimer.hasExpired())
	{
		stopTimer();

		// 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.fail()) requiredValue = 0;
			}
			// TODO: notify the user.
			llinfos << "found marker " << ll_install_failed_marker_path() << llendl;
			llinfos << "last install attempt failed" << llendl;
			LLFile::remove(ll_install_failed_marker_path());
			
			LLSD event;
			event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
			event["required"] = LLSD(requiredValue);
			LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);
			
			setState(LLUpdaterService::TERMINAL);
		}
		else
		{
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
    if(mTimer.getStarted() && mTimer.hasExpired())
    {
        stopTimer();

        // Check for failed install.
        if(LLFile::isfile(ll_install_failed_marker_path()))
        {
            LL_DEBUGS("UpdaterService") << "found marker " << ll_install_failed_marker_path() << LL_ENDL;
            int requiredValue = 0;
            {
                llifstream stream(ll_install_failed_marker_path().c_str());
                stream >> requiredValue;
                if(stream.fail())
                {
                    requiredValue = 0;
                }
            }
            // TODO: notify the user.
            LL_WARNS("UpdaterService") << "last install attempt failed" << LL_ENDL;;
            LLFile::remove(ll_install_failed_marker_path());

            LLSD event;
            event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
            event["required"] = LLSD(requiredValue);
            LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);

            setState(LLUpdaterService::TERMINAL);
        }
        //<FS:TM> 3.6.4 check this, commented out to compile
        //else
        //{
        //	std::string query_url = LLGridManager::getInstance()->getUpdateServiceURL();
        //	if ( !query_url.empty() )
        //	{
        //		mUpdateChecker.checkVersion(query_url, mChannel, mVersion,
        //									mPlatform, mPlatformVersion, mUniqueId,
        //									mWillingToTest);
        //		setState(LLUpdaterService::CHECKING_FOR_UPDATE);
        //	}
        //	else
        //	{
        //		LL_WARNS("UpdaterService")
        //			<< "No updater service defined for grid '" << LLGridManager::getInstance()->getGrid()
        //			<< "' will check again in " << mCheckPeriod << " seconds"
        //			<< LL_ENDL;
        //		// Because the grid can be changed after the viewer is started (when the first check takes place)
        //		// but before the user logs in, the next check may be on a different grid, so set the retry timer
        //		// even though this check did not happen.  The default time is once an hour, and if we're not
        //		// doing the check anyway the performance impact is completely insignificant.
        //		restartTimer(mCheckPeriod);
        //	}
        //}
    }
Пример #3
0
int ll_install_update(std::string const & script,
					  std::string const & updatePath,
					  bool required,
					  LLInstallScriptMode mode)
{
	std::string actualScriptPath;
	switch(mode) {
		case LL_COPY_INSTALL_SCRIPT_TO_TEMP:
			try {
				actualScriptPath = copy_to_temp(script);
			}
			catch (RelocateError &) {
				return -1;
			}
			break;
		case LL_RUN_INSTALL_SCRIPT_IN_PLACE:
			actualScriptPath = script;
			break;
		default:
			llassert(!"unpossible copy mode");
	}
	
	llinfos << "UpdateInstaller: installing " << updatePath << " using " <<
		actualScriptPath << LL_ENDL;
	
	LLProcessLauncher launcher;
	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();
	
	return result;
}