diff options
author | kh1 <karsten.heimrich@digia.com> | 2012-11-13 12:24:49 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2012-11-14 12:06:25 +0100 |
commit | 207cfebb778b77bc5308189d8e3a8d34019f1c72 (patch) | |
tree | 37bc8464aef62ed6b0499f90242510f5313f26b9 /src/sdk | |
parent | 0507fa96513a0542936644415efe4e14010b81c8 (diff) |
Implement cmd option to dump binary content into given dir.
Reuse already existing functionality, just fix the hard coded
"repository" path name. Also check if we are running offline only,
as otherwise there will be no data section.
Change-Id: Iac45d89822fceee9e527afe0dc9eb589e39e16e7
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/sdk')
-rw-r--r-- | src/sdk/installerbase.cpp | 30 | ||||
-rw-r--r-- | src/sdk/installerbase_p.cpp | 6 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index b12d5c9a0..b5aa6f5e4 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -189,6 +189,36 @@ int main(int argc, char *argv[]) return InstallerBase().replaceMaintenanceToolBinary(args); } + if (args.contains(QLatin1String("--dump-binary-data"))) { + bool verbose = args.contains(QLatin1String("--verbose")) || args.contains(QLatin1String("-v")); + + args = args.mid(args.indexOf(QLatin1String("--dump-binary-data")) + 1, 4); + // we expect at least -o and the output path + if (args.count() < 2 || !args.contains(QLatin1String("-o"))) { + InstallerBase::showUsage(); + return EXIT_FAILURE; + } + + // output path + const QString output = args.value(args.indexOf(QLatin1String("-o") + 1)); + if (output.isEmpty()) { + InstallerBase::showUsage(); + return EXIT_FAILURE; + } + + MyCoreApplication app(argc, argv); + + // input, if not given use current app + QString input = args.value(args.indexOf(QLatin1String("-i") + 1)); + if (input.isEmpty()) + input = QCoreApplication::applicationFilePath(); + + OperationRunner o(input); + o.setVerbose(verbose); + return o.runOperation(QStringList(QLatin1String("--runoperation")) + << QLatin1String("CreateLocalRepository") << input << output); + } + // from here, the "normal" installer binary is running MyApplication app(argc, argv); args = app.arguments(); diff --git a/src/sdk/installerbase_p.cpp b/src/sdk/installerbase_p.cpp index bf96a797a..e296c7e3b 100644 --- a/src/sdk/installerbase_p.cpp +++ b/src/sdk/installerbase_p.cpp @@ -333,6 +333,12 @@ void InstallerBase::showUsage() std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --update-installerbase [path/to/new/installerbase]" << std::setw(40) << "Patch a full installer with a new installer base" << std::endl; + std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --dump-binary-data [OPTION...] -o " + "path" << std::setw(40) << "Dumps the binary content into specified path (offline installer only)" + << std::endl; + std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " -i " + << std::setw(40) << "Path to binary data file, otherwise the current application is assumed to be " + "the input file." << std::endl; } /* static*/ |