Changed: Launch upgrade script even if we don't want to launch client

--HG--
branch : develop
This commit is contained in:
kervala 2016-02-21 13:16:50 +01:00
parent bfe817f92c
commit 9a4156d9cf

View file

@ -933,10 +933,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
contentPrefix += "\n"; contentPrefix += "\n";
// append content of script string contentSuffix;
fputs(contentPrefix.c_str(), fp);
fputs(content.c_str(), fp);
// if we need to restart Ryzom, we need to launch it in batch
std::string additionalParams; std::string additionalParams;
if (Args.haveLongArg("profile")) if (Args.haveLongArg("profile"))
@ -944,12 +943,18 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
additionalParams = "--profile " + Args.getLongArg("profile").front(); additionalParams = "--profile " + Args.getLongArg("profile").front();
} }
#ifdef NL_OS_WINDOWS
// launch upgrade script if present (it'll execute additional steps like moving or deleting files)
contentSuffix += "if exist \"%UPGRADE_FILE%\" call \"%UPGRADE_FILE%\"\n";
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
// client shouldn't be in memory anymore else it couldn't be overwritten // client shouldn't be in memory anymore else it couldn't be overwritten
contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str());
} }
#else #else
if (wantRyzomRestart)
{
// wait until client not in memory anymore // wait until client not in memory anymore
contentSuffix += toString("until ! pgrep %s > /dev/null; do sleep 1; done\n", CFile::getFilename(RyzomFilename).c_str()); contentSuffix += toString("until ! pgrep %s > /dev/null; do sleep 1; done\n", CFile::getFilename(RyzomFilename).c_str());
} }
@ -967,10 +972,13 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
// launch new client // launch new client
contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str());
}
#endif #endif
fputs(contentSuffix.c_str(), fp); // append content of script
} fputs(contentPrefix.c_str(), fp);
fputs(content.c_str(), fp);
fputs(contentSuffix.c_str(), fp);
bool writeError = ferror(fp) != 0; bool writeError = ferror(fp) != 0;
bool diskFull = ferror(fp) && errno == 28 /* ENOSPC */; bool diskFull = ferror(fp) && errno == 28 /* ENOSPC */;