diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-08-10 11:14:28 +0200 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-08-14 15:54:34 +0000 |
commit | 5623b09db0a4cd57073dc640b1d08232faa7195d (patch) | |
tree | a3697c65ca329c97a9f9a23bd91cc049c38ff016 | |
parent | 4f762b1d1f4e2bf61a24c82e6cdcfdfffee655f4 (diff) |
Make installed-apps-manifest-dir configuration entry optional
If not specified the ApplicationInstaller and corresponding D-Bus interfaces
won't be instantiated and appman will be left only with built-in apps, which
is fine for many deployments.
Change-Id: I4a3267de91e5bd83955e47530bceb2aa47c5a861
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r-- | doc/configuration.qdoc | 4 | ||||
-rw-r--r-- | examples/applicationmanager/animated-windows/am-config.yaml | 1 | ||||
-rw-r--r-- | examples/applicationmanager/hello-world/am-config.yaml | 1 | ||||
-rw-r--r-- | examples/applicationmanager/minidesk/am-config.yaml | 1 | ||||
-rw-r--r-- | examples/applicationmanager/multi-views/am-config.yaml | 1 | ||||
-rw-r--r-- | src/installer-lib/applicationinstaller.cpp | 3 | ||||
-rw-r--r-- | src/main-lib/defaultconfiguration.cpp | 7 | ||||
-rw-r--r-- | src/main-lib/main.cpp | 29 |
8 files changed, 30 insertions, 17 deletions
diff --git a/doc/configuration.qdoc b/doc/configuration.qdoc index 833ebb38..dc00cfd2 100644 --- a/doc/configuration.qdoc +++ b/doc/configuration.qdoc @@ -135,7 +135,9 @@ all your imports paths and file references relative to your main config file. \li \b --installed-apps-manifest-dir \br \e applications/installedAppsManifestDir \li string - \li The base directory for installed application manifests. (defaults: \c /opt/am/manifests) + \li The base directory for installed application manifests. This must be specified if you + want to install new applications, otherwise only the built-in ones will be available. + (default: empty/disabled) \row \li \b --app-image-mount-dir \br \e applications/appImageMountDir diff --git a/examples/applicationmanager/animated-windows/am-config.yaml b/examples/applicationmanager/animated-windows/am-config.yaml index d394fd16..5db21e36 100644 --- a/examples/applicationmanager/animated-windows/am-config.yaml +++ b/examples/applicationmanager/animated-windows/am-config.yaml @@ -3,7 +3,6 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installedAppsManifestDir: "/tmp/animated-windows/manifests" ui: mainQml: "${CONFIG_PWD}/system-ui/main.qml" diff --git a/examples/applicationmanager/hello-world/am-config.yaml b/examples/applicationmanager/hello-world/am-config.yaml index 7b4ee626..5db21e36 100644 --- a/examples/applicationmanager/hello-world/am-config.yaml +++ b/examples/applicationmanager/hello-world/am-config.yaml @@ -3,7 +3,6 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installedAppsManifestDir: "/tmp/hello-world/manifests" ui: mainQml: "${CONFIG_PWD}/system-ui/main.qml" diff --git a/examples/applicationmanager/minidesk/am-config.yaml b/examples/applicationmanager/minidesk/am-config.yaml index 376a2265..86e26c2a 100644 --- a/examples/applicationmanager/minidesk/am-config.yaml +++ b/examples/applicationmanager/minidesk/am-config.yaml @@ -10,7 +10,6 @@ installationLocations: applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installedAppsManifestDir: "/tmp/minidesk/manifests" logging: rules: diff --git a/examples/applicationmanager/multi-views/am-config.yaml b/examples/applicationmanager/multi-views/am-config.yaml index e9bfb77b..6a6a9393 100644 --- a/examples/applicationmanager/multi-views/am-config.yaml +++ b/examples/applicationmanager/multi-views/am-config.yaml @@ -10,7 +10,6 @@ installationLocations: applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installedAppsManifestDir: "/tmp/multi-views/manifests" logging: rules: diff --git a/src/installer-lib/applicationinstaller.cpp b/src/installer-lib/applicationinstaller.cpp index 11403ffa..19e5f1b6 100644 --- a/src/installer-lib/applicationinstaller.cpp +++ b/src/installer-lib/applicationinstaller.cpp @@ -67,6 +67,9 @@ part of the application manager. It provides both a DBus and QML APIs for all of its functionality. + \note The ApplicationInstaller singleton and its corresponding DBus API are only available if you + specify a base directory for installed application manifests. See \l{Configuration} for details. + \target TaskStates The following table describes all possible states that a background task could be in: diff --git a/src/main-lib/defaultconfiguration.cpp b/src/main-lib/defaultconfiguration.cpp index 0d838a2f..bfbefc56 100644 --- a/src/main-lib/defaultconfiguration.cpp +++ b/src/main-lib/defaultconfiguration.cpp @@ -90,7 +90,7 @@ DefaultConfiguration::DefaultConfiguration(const QStringList &defaultConfigFileP m_clp.addOption({ qSL("database"), qSL("filepath of the application database cache."), qSL("file") }); m_clp.addOption({ { qSL("r"), qSL("recreate-database") }, qSL("recreate the application database cache.") }); m_clp.addOption({ qSL("builtin-apps-manifest-dir"), qSL("base directory for built-in application manifests."), qSL("dir") }); - m_clp.addOption({ qSL("installed-apps-manifest-dir"), qSL("base directory for installed application manifests."), qSL("dir"), qSL("/opt/am/manifests") }); + m_clp.addOption({ qSL("installed-apps-manifest-dir"), qSL("base directory for installed application manifests."), qSL("dir") }); m_clp.addOption({ qSL("app-image-mount-dir"), qSL("base directory where application images are mounted to."), qSL("dir") }); #if defined(QT_DBUS_LIB) # if defined(Q_OS_LINUX) @@ -144,6 +144,11 @@ void DefaultConfiguration::parse(QStringList *deploymentWarnings) if (database().isEmpty()) *deploymentWarnings << qL1S("No --database command line parameter or applications/database configuration" " key specified. Database won't be cached to speed up subsequent System-UI startups."); + + if (installedAppsManifestDir().isEmpty()) + *deploymentWarnings << qL1S("No --installed-apps-manifest-dir command line parameter or" + " applications/installedAppsManifestDir configuration key specified. It won't be possible to install," + " remove or access installable applications."); } QString DefaultConfiguration::mainQmlFile() const diff --git a/src/main-lib/main.cpp b/src/main-lib/main.cpp index f247ec75..8fc7cdfa 100644 --- a/src/main-lib/main.cpp +++ b/src/main-lib/main.cpp @@ -227,9 +227,13 @@ void Main::setup(const DefaultConfiguration *cfg, const QStringList &deploymentW setupSingletons(cfg->containerSelectionConfiguration(), cfg->quickLaunchRuntimesPerContainer(), cfg->quickLaunchIdleLoad(), cfg->singleApp()); - setupInstaller(cfg->appImageMountDir(), cfg->caCertificates(), - std::bind(&DefaultConfiguration::applicationUserIdSeparation, cfg, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + if (m_installedAppsManifestDir.isEmpty()) { + StartupTimer::instance()->checkpoint("skipping installer"); + } else { + setupInstaller(cfg->appImageMountDir(), cfg->caCertificates(), + std::bind(&DefaultConfiguration::applicationUserIdSeparation, cfg, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + } setupQmlEngine(cfg->importPaths(), cfg->style()); setupWindowTitle(QString(), cfg->windowIcon()); @@ -530,7 +534,7 @@ void Main::setupInstaller(const QString &appImageMountDir, const QStringList &ca throw Exception("the installer is enabled, but the device-id is empty"); if (Q_UNLIKELY(!QDir::root().mkpath(m_installedAppsManifestDir))) - throw Exception("could not create manifest directory %1").arg(m_installedAppsManifestDir); + throw Exception("could not create manifest directory for installed applications: \'%1\'").arg(m_installedAppsManifestDir); if (Q_UNLIKELY(!appImageMountDir.isEmpty() && !QDir::root().mkpath(appImageMountDir))) throw Exception("could not create the image-mount directory %1").arg(appImageMountDir); @@ -946,12 +950,14 @@ void Main::registerDBusInterfaces(const std::function<QString(const char *)> &bu throw Exception(Error::DBus, "could not set DBus policy for ApplicationManager"); # if !defined(AM_DISABLE_INSTALLER) - auto aia = new ApplicationInstallerDBusContextAdaptor(m_applicationInstaller); - const char *aiInterfaceName = dbusInterfaceName(m_applicationInstaller); - registerDBusObject(aia->generatedAdaptor(), busForInterface(aiInterfaceName), - "io.qt.ApplicationManager", aiInterfaceName, "/ApplicationInstaller"); - if (!DBusPolicy::add(aia->generatedAdaptor(), policyForInterface(aiInterfaceName))) - throw Exception(Error::DBus, "could not set DBus policy for ApplicationInstaller"); + if (m_applicationInstaller) { + auto aia = new ApplicationInstallerDBusContextAdaptor(m_applicationInstaller); + const char *aiInterfaceName = dbusInterfaceName(m_applicationInstaller); + registerDBusObject(aia->generatedAdaptor(), busForInterface(aiInterfaceName), + "io.qt.ApplicationManager", aiInterfaceName, "/ApplicationInstaller"); + if (!DBusPolicy::add(aia->generatedAdaptor(), policyForInterface(aiInterfaceName))) + throw Exception(Error::DBus, "could not set DBus policy for ApplicationInstaller"); + } # endif # if !defined(AM_HEADLESS) @@ -1120,7 +1126,8 @@ QVector<AbstractApplicationInfo *> Main::scanForApplications(const QStringList & for (const QString &dir : builtinAppsDirs) scan(dir, true); #if !defined(AM_DISABLE_INSTALLER) - scan(installedAppsDir, false); + if (!installedAppsDir.isEmpty()) + scan(installedAppsDir, false); #endif return result; } |