bool LLUpdaterServiceImpl::checkForInstall(bool launchInstaller) { bool foundInstall = false; // return true if install is found. llifstream update_marker(update_marker_path().c_str(), std::ios::in | std::ios::binary); if(update_marker.is_open()) { // Found an update info - now lets see if its valid. LLSD update_info; LLSDSerialize::fromXMLDocument(update_info, update_marker); update_marker.close(); // Get the path to the installer file. std::string path(update_info.get("path")); std::string downloader_version(update_info["current_version"]); if (downloader_version != ll_get_version()) { // This viewer is not the same version as the one that downloaded // the update. Do not install this update. LL_INFOS("UpdaterService") << "ignoring update downloaded by " << "different viewer version " << downloader_version << LL_ENDL; if (! path.empty()) { LL_INFOS("UpdaterService") << "removing " << path << LL_ENDL; LLFile::remove(path); LLFile::remove(update_marker_path()); } foundInstall = false; } else if (path.empty()) { LL_WARNS("UpdaterService") << "Marker file " << update_marker_path() << " 'path' entry empty, ignoring" << LL_ENDL; foundInstall = false; } else if (! LLFile::isfile(path)) { LL_WARNS("UpdaterService") << "Nonexistent installer " << path << ", ignoring" << LL_ENDL; foundInstall = false; } else { if(launchInstaller) { setState(LLUpdaterService::INSTALLING); LLFile::remove(update_marker_path()); int result = ll_install_update(install_script_path(), path, update_info["required"].asBoolean(), install_script_mode()); if((result == 0) && mAppExitCallback) { mAppExitCallback(); } else if(result != 0) { LL_WARNS("UpdaterService") << "failed to run update install script" << LL_ENDL; } else { ; // No op. } } foundInstall = true; } } return foundInstall; }
bool LLUpdaterServiceImpl::checkForInstall(bool launchInstaller) { bool foundInstall = false; // return true if install is found. llifstream update_marker(update_marker_path(), std::ios::in | std::ios::binary); if(update_marker.is_open()) { // Found an update info - now lets see if its valid. LLSD update_info; LLSDSerialize::fromXMLDocument(update_info, update_marker); update_marker.close(); // Get the path to the installer file. LLSD path = update_info.get("path"); if(update_info["current_version"].asString() != ll_get_version()) { // This viewer is not the same version as the one that downloaded // the update. Do not install this update. if(!path.asString().empty()) { llinfos << "ignoring update dowloaded by different client version" << llendl; LLFile::remove(path.asString()); LLFile::remove(update_marker_path()); } else { ; // Nothing to clean up. } foundInstall = false; } else if(path.isDefined() && !path.asString().empty()) { if(launchInstaller) { setState(LLUpdaterService::INSTALLING); LLFile::remove(update_marker_path()); int result = ll_install_update(install_script_path(), update_info["path"].asString(), update_info["required"].asBoolean(), install_script_mode()); if((result == 0) && mAppExitCallback) { mAppExitCallback(); } else if(result != 0) { llwarns << "failed to run update install script" << LL_ENDL; } else { ; // No op. } } foundInstall = true; } } return foundInstall; }