Skip to content

Commit

Permalink
rpmostree: Add a client ID
Browse files Browse the repository at this point in the history
See: coreos/rpm-ostree#1368
This will help users understand what software initiated updates.
  • Loading branch information
cgwalters committed May 16, 2018
1 parent 8715066 commit 4447b4a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/rpm-ostree/gs-plugin-rpm-ostree.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

#include "gs-rpmostree-generated.h"

/* This shows up in the `rpm-ostree status` as the software that
* initiated the update.
*/
#define GS_RPMOSTREE_CLIENT_ID PACKAGE_NAME

struct GsPluginData {
GsRPMOSTreeOS *os_proxy;
GsRPMOSTreeSysroot *sysroot_proxy;
Expand Down Expand Up @@ -85,6 +90,7 @@ gboolean
gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
g_autoptr(GVariantBuilder) options_builder = NULL;

/* Create a proxy for sysroot */
if (priv->sysroot_proxy == NULL) {
Expand Down Expand Up @@ -127,9 +133,12 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
}
}

options_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (options_builder, "{sv}", "id",
g_variant_new_string (GS_RPMOSTREE_CLIENT_ID));
/* Register as a client so that the rpm-ostree daemon doesn't exit */
if (!gs_rpmostree_sysroot_call_register_client_sync (priv->sysroot_proxy,
g_variant_new ("a{sv}", NULL),
g_variant_new ("a{sv}", g_variant_builder_end (options_builder)),
cancellable,
error)) {
gs_utils_error_convert_gio (error);
Expand Down

0 comments on commit 4447b4a

Please sign in to comment.