diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2020-12-01 13:00:15 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-01-15 09:27:07 +0200 |
commit | 20f354b38b83e4aab107b388fe3c5e2ccd878946 (patch) | |
tree | 9da138aca91abdd931eb9fb4c74ffb35dddc7377 /src/libs/ifwtools/binarycreator.cpp | |
parent | f61c19eb81dc692b9c5215f5bf94f3426b0f4f86 (diff) |
Add support for generating offline installer from online
Task-number: QTIFW-1945
Change-Id: Ic8a076a28385e99ad09cfbccd07c7012d6570639
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs/ifwtools/binarycreator.cpp')
-rw-r--r-- | src/libs/ifwtools/binarycreator.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/libs/ifwtools/binarycreator.cpp b/src/libs/ifwtools/binarycreator.cpp index 8fcc14ca3..deea01ed7 100644 --- a/src/libs/ifwtools/binarycreator.cpp +++ b/src/libs/ifwtools/binarycreator.cpp @@ -37,6 +37,7 @@ #include "repository.h" #include "settings.h" #include "utils.h" +#include "fileutils.h" #include <QDateTime> #include <QDirIterator> @@ -433,8 +434,13 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt return EXIT_FAILURE; } +#ifdef Q_OS_MACOS + // installer executable + chmod755(input.outputPath); +#endif #ifndef Q_OS_WIN - chmod755(out.fileName()); + // installer executable on linux, installer.dat on macOS + chmod755(targetName); #endif QFile::remove(tempFile); @@ -580,6 +586,9 @@ void QInstallerTools::copyConfigData(const QString &configFile, const QString &t const QString targetConfigFile = targetDir + QLatin1String("/config.xml"); QInstallerTools::copyWithException(sourceConfigFile, targetConfigFile, QLatin1String("configuration")); + // Permissions might be set to bogus values + QInstaller::setDefaultFilePermissions(targetConfigFile, DefaultFilePermissions::NonExecutable); + QFile configXml(targetConfigFile); QInstaller::openForRead(&configXml); @@ -699,13 +708,19 @@ int QInstallerTools::createBinary(BinaryCreatorArgs args, QString &argumentError "contain any components apart from the root component."); return EXIT_FAILURE; } -#ifdef Q_OS_WIN - if (!args.templateBinary.endsWith(suffix)) - args.templateBinary = args.templateBinary + suffix; -#endif if (!QFileInfo(args.templateBinary).exists()) { +#ifdef Q_OS_WIN + if (!args.templateBinary.endsWith(suffix)) + args.templateBinary = args.templateBinary + suffix; + // Try again with added executable suffix + if (!QFileInfo(args.templateBinary).exists()) { + argumentError = QString::fromLatin1("Error: Template base binary not found at the specified location."); + return EXIT_FAILURE; + } +#else argumentError = QString::fromLatin1("Error: Template not found at the specified location."); return EXIT_FAILURE; +#endif } const QFileInfo fi(args.configFile); if (!fi.exists()) { |