From ac38ce9ee96bc2b827d89b089a9d2e2ca37608d7 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Tue, 22 Oct 2019 13:33:11 +0300 Subject: Uninstall selected packages from command line Components can be uninstalled from CLI with --uninstallPackages package1,package2,... Replicates the same behavior as when removing from visual UI, so forced installation, virtual and components installed as autodependency cannot be uninstalled. Change-Id: Ibcd87b5ceb8e509c84c6944510c23e59b28dedb9 Reviewed-by: Iikka Eklund --- src/sdk/installerbase.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/sdk/installerbase.cpp') diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index b63c911fa..a14999b45 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -377,6 +377,15 @@ int InstallerBase::run() if (!setTargetDirFromCommandLine(parser)) return EXIT_FAILURE; m_core->installDefaultComponentsSilently(); + } else if (parser.isSet(QLatin1String(CommandLineOptions::UninstallSelectedPackages))) { + if (m_core->isInstaller()) + throw QInstaller::Error(QLatin1String("Cannot start installer binary as package manager.")); + m_core->setPackageManager(); + QStringList packages; + const QString &value = parser.value(QLatin1String(CommandLineOptions::UninstallSelectedPackages)); + if (!value.isEmpty()) + packages = value.split(QLatin1Char(','), QString::SkipEmptyParts); + m_core->uninstallComponentsSilently(packages); } else { m_core->setCommandLineInstance(false); //create the wizard GUI -- cgit v1.2.3