Commit c4c4e53f authored by Konstantin Podsvirov's avatar Konstantin Podsvirov
Browse files

CPackIFW: Add CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE variable

Add CPACK_IFW_DISABLE_COMMAND_LINE_INTERFACE variable to
prevents the user from passing any consumer command to installer,
like install, update and remove.
This feature available only since QtIFW 4.0.
parent 82828401
......@@ -195,6 +195,14 @@ Package
Is ``ON`` for QtIFW less 2.0 tools.
.. variable:: CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE
.. versionadded:: 3.22
Set to ``ON`` if command line interface features should be disabled.
Is ``OFF`` by default, but will only have an effect if using QtIFW 4.0 or later.
.. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
.. versionadded:: 3.3
......
cpackifw-package-disable-command-line-interface
-----------------------------------------------
* The :cpack_gen:`CPack IFW Generator` gained new
:variable:`CPACK_IFW_DISABLE_COMMAND_LINE_INTERFACE` variable to
prevents the user from passing any consumer command to installer, like
``install``, ``update`` and ``remove``.
This feature available only since QtIFW 4.0.
......@@ -255,6 +255,37 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
}
}
// DisableCommandLineInterface
if (const char* option =
this->GetOption("CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
if (!this->IsVersionLess("4.0")) {
if (this->IsSetToOff(
"CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
this->DisableCommandLineInterface = "false";
} else if (this->IsOn(
"CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
this->DisableCommandLineInterface = "true";
} else {
this->DisableCommandLineInterface.clear();
}
} else {
std::string currentVersionMsg;
if (this->Generator) {
currentVersionMsg =
"QtIFW version " + this->Generator->FrameworkVersion;
} else {
currentVersionMsg = "an older QtIFW version";
}
cmCPackIFWLogger(
WARNING,
"Option CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE is set to \""
<< option
<< "\", but it is only supported with QtIFW version 4.0 or later. "
"It is being ignored because you are using "
<< currentVersionMsg << std::endl);
}
}
// Space in path
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
......@@ -501,6 +532,13 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
}
}
// DisableCommandLineInterface
if (!this->IsVersionLess("4.0") &&
!this->DisableCommandLineInterface.empty()) {
xout.Element("DisableCommandLineInterface",
this->DisableCommandLineInterface);
}
// Control script (copy to config dir)
if (!this->IsVersionLess("2.0") && !this->ControlScript.empty()) {
std::string name = cmSystemTools::GetFilenameName(this->ControlScript);
......
......@@ -109,6 +109,9 @@ public:
/// uninstalling
std::string RemoveTargetDir;
/// Set to true if command line interface features should be disabled
std::string DisableCommandLineInterface;
/// Set to false if the installation path cannot contain space characters
std::string AllowSpaceInPath;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment