diff options
author | kh1 <karsten.heimrich@digia.com> | 2014-07-14 12:10:06 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2014-07-15 11:30:48 +0200 |
commit | 7e22555eaab60a575bf8185b860ba6f7d6639515 (patch) | |
tree | f62eea78c3de4663c38115c2d3fef4dbad255c48 /src/sdk/installerbase.cpp | |
parent | 7186834d5094083cff984bfc3002acaa5b8ec988 (diff) |
Move updater class into sdk binary and rename to UpdateChecker.
Remove some now superfluous methods from binary format.
Adjust initializing some objects as we need them not earlier.
Unify implementation of accessing the right binary to read the
content from.
UpdateChecker does now have its own run checker, makes it possible
to run the binary even if a e.g. maintenace tool is already running.
Change-Id: I94f32f7f38b62b5aee433753abc2fe72e879ddc9
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/sdk/installerbase.cpp')
-rw-r--r-- | src/sdk/installerbase.cpp | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 2e4c88dbb..6a9198d5e 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -43,6 +43,7 @@ #include "installerbasecommons.h" #include "sdkapp.h" #include "tabcontroller.h" +#include "updatechecker.h" #include <binaryformat.h> #include <errors.h> @@ -52,7 +53,6 @@ #include <remoteserver.h> #include <settings.h> #include <utils.h> -#include <updater.h> #include <kdselfrestarter.h> #include <kdrunoncechecker.h> @@ -95,8 +95,6 @@ int main(int argc, char *argv[]) #endif qsrand(QDateTime::currentDateTime().toTime_t()); - const KDSelfRestarter restarter(argc, argv); - KDRunOnceChecker runCheck(QLatin1String("lockmyApp1234865.lock")); QCommandLineParser parser; QCommandLineOption help = parser.addHelpOption(); @@ -257,18 +255,11 @@ int main(int argc, char *argv[]) #endif } - if (parser.isSet(checkUpdates)) { - SDKApp<QCoreApplication> app(argc, argv); - if (runCheck.isRunning(KDRunOnceChecker::ProcessList)) - throw Error(QLatin1String("An instance is already checking for updates.")); - - Updater u; - u.setVerbose(parser.isSet(verbose)); - return u.checkForUpdates() ? EXIT_SUCCESS : EXIT_FAILURE; - } + if (parser.isSet(checkUpdates)) + return UpdateChecker().check(argc, argv); SDKApp<QApplication> app(argc, argv); - QInstaller::init(); // register custom operations + KDRunOnceChecker runCheck(QLatin1String("lockmyApp1234865.lock")); if (runCheck.isRunning(KDRunOnceChecker::ProcessList) || runCheck.isRunning(KDRunOnceChecker::Lockfile)) { @@ -279,6 +270,9 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } + const KDSelfRestarter restarter(argc, argv); + QInstaller::init(); // register custom operations + if (QInstaller::isVerbose()) { qDebug() << VERSION; qDebug() << "Arguments:" << app.arguments(); @@ -293,16 +287,7 @@ int main(int argc, char *argv[]) qDebug() << QString::fromLatin1(" %1").arg(it.next()); } - QString binaryFile = QCoreApplication::applicationFilePath(); -#ifdef Q_OS_OSX - // The installer binary on OSX does not contain the binary content, it's put - // into the resources folder as separate file. Adjust the actual binary path. - QDir resourcePath(QFileInfo(binaryFile).dir()); - resourcePath.cdUp(); - resourcePath.cd(QLatin1String("Resources")); - binaryFile = resourcePath.filePath(QLatin1String("installer.dat")); -#endif - BinaryContent content = BinaryContent::readAndRegisterFromBinary(binaryFile); + BinaryContent content = BinaryContent::readAndRegisterFromBinary(app.binaryFile()); // instantiate the installer we are actually going to use PackageManagerCore core(content.magicMarker(), content.performedOperations()); |