[gnome-software/wip/ubuntu-master: 21/21] snap: Install classic snaps
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/ubuntu-master: 21/21] snap: Install classic snaps
- Date: Fri, 1 Sep 2017 04:42:19 +0000 (UTC)
commit 7860c1c27323c1977951f7760bce8ddd689447e4
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Aug 24 14:26:16 2017 +1200
snap: Install classic snaps
plugins/snap/gs-plugin-snap.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index c7de219..a624704 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -244,6 +244,8 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
g_autofree gchar *unique_id = NULL;
GsApp *cached_app;
g_autoptr(GsApp) app = NULL;
+ SnapdConfinement confinement;
+ GEnumClass *enum_class;
switch (snapd_snap_get_snap_type (snap)) {
case SNAPD_SNAP_TYPE_APP:
@@ -274,7 +276,13 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
gs_app_add_quirk (app, AS_APP_QUIRK_NOT_LAUNCHABLE);
if (gs_plugin_check_distro_id (plugin, "ubuntu"))
gs_app_add_quirk (app, AS_APP_QUIRK_PROVENANCE);
- if (priv->system_confinement == SNAPD_SYSTEM_CONFINEMENT_STRICT && snapd_snap_get_confinement (snap)
== SNAPD_CONFINEMENT_STRICT)
+
+ confinement = snapd_snap_get_confinement (snap);
+ enum_class = g_type_class_ref (SNAPD_TYPE_CONFINEMENT);
+ gs_app_set_metadata (app, "snap::confinement", g_enum_get_value (enum_class,
confinement)->value_nick);
+ g_type_class_unref (enum_class);
+
+ if (priv->system_confinement == SNAPD_SYSTEM_CONFINEMENT_STRICT && confinement ==
SNAPD_CONFINEMENT_STRICT)
gs_app_add_kudo (app, GS_APP_KUDO_SANDBOXED);
return g_steal_pointer (&app);
@@ -748,13 +756,16 @@ gs_plugin_app_install (GsPlugin *plugin,
GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
+ SnapdInstallFlags flags = SNAPD_INSTALL_FLAGS_NONE;
/* We can only install apps we know of */
if (g_strcmp0 (gs_app_get_management_plugin (app), "snap") != 0)
return TRUE;
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- if (!snapd_client_install2_sync (priv->client, SNAPD_INSTALL_FLAGS_NONE, gs_app_get_id (app), NULL,
NULL, progress_cb, app, cancellable, error)) {
+ if (g_strcmp0 (gs_app_get_metadata_item (app, "snap::confinement"), "classic") == 0)
+ flags |= SNAPD_INSTALL_FLAGS_CLASSIC;
+ if (!snapd_client_install2_sync (priv->client, flags, gs_app_get_id (app), NULL, NULL, progress_cb,
app, cancellable, error)) {
gs_app_set_state_recover (app);
snapd_error_convert (error);
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]