diff --git a/src/app/rpmostree-builtin-livefs.c b/src/app/rpmostree-builtin-livefs.c
index fd0c7e4a7a..c7c9d0cac0 100644
--- a/src/app/rpmostree-builtin-livefs.c
+++ b/src/app/rpmostree-builtin-livefs.c
@@ -60,42 +60,39 @@ rpmostree_ex_builtin_livefs (int argc,
GCancellable *cancellable,
GError **error)
{
- int exit_status = EXIT_FAILURE;
- g_autoptr(GOptionContext) context = g_option_context_new ("- Apply pending deployment changes to booted deployment");
- glnx_unref_object RPMOSTreeOS *os_proxy = NULL;
+ _cleanup_peer_ GPid peer_pid = 0;
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
- g_autofree char *transaction_address = NULL;
-
+ g_autoptr(GOptionContext) context = g_option_context_new ("- Apply pending deployment changes to booted deployment");
if (!rpmostree_option_context_parse (context,
option_entries,
&argc, &argv,
invocation,
cancellable,
&sysroot_proxy,
+ &peer_pid,
error))
- goto out;
+ return EXIT_FAILURE;
- if (!rpmostree_load_os_proxy (sysroot_proxy, NULL,
- cancellable, &os_proxy, error))
- goto out;
+ g_autoptr(RPMOSTreeOS) os_proxy = NULL;
+ g_autoptr(RPMOSTreeOSExperimental) osexperimental_proxy = NULL;
+ if (!rpmostree_load_os_proxies (sysroot_proxy, NULL,
+ cancellable, &os_proxy,
+ &osexperimental_proxy, error))
+ return EXIT_FAILURE;
- if (!rpmostree_os_call_live_fs_sync (os_proxy,
- get_args_variant (),
- &transaction_address,
- cancellable,
- error))
- goto out;
+ g_autofree char *transaction_address = NULL;
+ if (!rpmostree_osexperimental_call_live_fs_sync (osexperimental_proxy,
+ get_args_variant (),
+ &transaction_address,
+ cancellable,
+ error))
+ return EXIT_FAILURE;
if (!rpmostree_transaction_get_response_sync (sysroot_proxy,
transaction_address,
cancellable,
error))
- goto out;
-
- exit_status = EXIT_SUCCESS;
-out:
- /* Does nothing if using the message bus. */
- rpmostree_cleanup_peer ();
+ return EXIT_FAILURE;
- return exit_status;
+ return EXIT_SUCCESS;
}
diff --git a/src/daemon/org.projectatomic.rpmostree1.xml b/src/daemon/org.projectatomic.rpmostree1.xml
index 53a51f7f67..d750af26b3 100644
--- a/src/daemon/org.projectatomic.rpmostree1.xml
+++ b/src/daemon/org.projectatomic.rpmostree1.xml
@@ -224,11 +224,6 @@
-
-
-
-
-
@@ -239,6 +234,11 @@
+
+
+
+
+
diff --git a/src/daemon/rpmostreed-os-experimental.c b/src/daemon/rpmostreed-os-experimental.c
index f69798f5fa..9c65f414c6 100644
--- a/src/daemon/rpmostreed-os-experimental.c
+++ b/src/daemon/rpmostreed-os-experimental.c
@@ -57,6 +57,23 @@ G_DEFINE_TYPE_WITH_CODE (RpmostreedOSExperimental,
rpmostreed_osexperimental_iface_init)
);
+static RpmostreedTransaction *
+merge_compatible_txn (RpmostreedOSExperimental *self,
+ GDBusMethodInvocation *invocation)
+{
+ glnx_unref_object RpmostreedTransaction *transaction = NULL;
+
+ /* If a compatible transaction is in progress, share its bus address. */
+ transaction = rpmostreed_transaction_monitor_ref_active_transaction (self->transaction_monitor);
+ if (transaction != NULL)
+ {
+ if (rpmostreed_transaction_is_compatible (transaction, invocation))
+ return g_steal_pointer (&transaction);
+ }
+
+ return NULL;
+}
+
/* ---------------------------------------------------------------------------------------------------- */
static void
@@ -119,11 +136,78 @@ osexperimental_handle_moo (RPMOSTreeOSExperimental *interface,
rpmostree_osexperimental_complete_moo (interface, invocation, result);
return TRUE;
}
+static RpmOstreeTransactionLiveFsFlags
+livefs_flags_from_options (GVariant *options)
+{
+ RpmOstreeTransactionLiveFsFlags ret = 0;
+ GVariantDict options_dict;
+ gboolean opt = FALSE;
+
+ g_variant_dict_init (&options_dict, options);
+ if (g_variant_dict_lookup (&options_dict, "dry-run", "b", &opt) && opt)
+ ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_DRY_RUN;
+ if (g_variant_dict_lookup (&options_dict, "replace", "b", &opt) && opt)
+ ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_ALLOW_REPLACE;
+ if (g_variant_dict_lookup (&options_dict, "partial", "b", &opt) && opt)
+ ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_IGNORE_NON_USR;
+
+ g_variant_dict_clear (&options_dict);
+
+ return ret;
+}
+
+static gboolean
+osexperimental_handle_live_fs (RPMOSTreeOSExperimental *interface,
+ GDBusMethodInvocation *invocation,
+ GVariant *arg_options)
+{
+ RpmostreedOSExperimental *self = RPMOSTREED_OSEXPERIMENTAL (interface);
+ glnx_unref_object RpmostreedTransaction *transaction = NULL;
+ glnx_unref_object OstreeSysroot *ot_sysroot = NULL;
+ g_autoptr(GCancellable) cancellable = g_cancellable_new ();
+ GError *local_error = NULL;
+
+ transaction = merge_compatible_txn (self, invocation);
+ if (transaction)
+ goto out;
+
+ if (!rpmostreed_sysroot_load_state (rpmostreed_sysroot_get (),
+ cancellable,
+ &ot_sysroot,
+ NULL,
+ &local_error))
+ goto out;
+
+ transaction = rpmostreed_transaction_new_livefs (invocation,
+ ot_sysroot,
+ livefs_flags_from_options (arg_options),
+ cancellable,
+ &local_error);
+ if (transaction == NULL)
+ goto out;
+
+ rpmostreed_transaction_monitor_add (self->transaction_monitor, transaction);
+
+out:
+ if (local_error != NULL)
+ {
+ g_dbus_method_invocation_take_error (invocation, local_error);
+ }
+ else
+ {
+ const char *client_address;
+ client_address = rpmostreed_transaction_get_client_address (transaction);
+ rpmostree_osexperimental_complete_live_fs (interface, invocation, client_address);
+ }
+
+ return TRUE;
+}
static void
rpmostreed_osexperimental_iface_init (RPMOSTreeOSExperimentalIface *iface)
{
iface->handle_moo = osexperimental_handle_moo;
+ iface->handle_live_fs = osexperimental_handle_live_fs;
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/daemon/rpmostreed-os.c b/src/daemon/rpmostreed-os.c
index 2e79631980..47eb444869 100644
--- a/src/daemon/rpmostreed-os.c
+++ b/src/daemon/rpmostreed-os.c
@@ -900,73 +900,6 @@ os_handle_cleanup (RPMOSTreeOS *interface,
return TRUE;
}
-static RpmOstreeTransactionLiveFsFlags
-livefs_flags_from_options (GVariant *options)
-{
- RpmOstreeTransactionLiveFsFlags ret = 0;
- GVariantDict options_dict;
- gboolean opt = FALSE;
-
- g_variant_dict_init (&options_dict, options);
- if (g_variant_dict_lookup (&options_dict, "dry-run", "b", &opt) && opt)
- ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_DRY_RUN;
- if (g_variant_dict_lookup (&options_dict, "replace", "b", &opt) && opt)
- ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_ALLOW_REPLACE;
- if (g_variant_dict_lookup (&options_dict, "partial", "b", &opt) && opt)
- ret |= RPMOSTREE_TRANSACTION_LIVEFS_FLAG_IGNORE_NON_USR;
-
- g_variant_dict_clear (&options_dict);
-
- return ret;
-}
-
-static gboolean
-os_handle_live_fs (RPMOSTreeOS *interface,
- GDBusMethodInvocation *invocation,
- GVariant *arg_options)
-{
- RpmostreedOS *self = RPMOSTREED_OS (interface);
- glnx_unref_object RpmostreedTransaction *transaction = NULL;
- glnx_unref_object OstreeSysroot *ot_sysroot = NULL;
- g_autoptr(GCancellable) cancellable = g_cancellable_new ();
- GError *local_error = NULL;
-
- transaction = merge_compatible_txn (self, invocation);
- if (transaction)
- goto out;
-
- if (!rpmostreed_sysroot_load_state (rpmostreed_sysroot_get (),
- cancellable,
- &ot_sysroot,
- NULL,
- &local_error))
- goto out;
-
- transaction = rpmostreed_transaction_new_livefs (invocation,
- ot_sysroot,
- livefs_flags_from_options (arg_options),
- cancellable,
- &local_error);
- if (transaction == NULL)
- goto out;
-
- rpmostreed_transaction_monitor_add (self->transaction_monitor, transaction);
-
-out:
- if (local_error != NULL)
- {
- g_dbus_method_invocation_take_error (invocation, local_error);
- }
- else
- {
- const char *client_address;
- client_address = rpmostreed_transaction_get_client_address (transaction);
- rpmostree_os_complete_live_fs (interface, invocation, client_address);
- }
-
- return TRUE;
-}
-
static gboolean
os_handle_get_cached_rebase_rpm_diff (RPMOSTreeOS *interface,
GDBusMethodInvocation *invocation,
@@ -1354,7 +1287,6 @@ rpmostreed_os_iface_init (RPMOSTreeOSIface *iface)
iface->handle_pkg_change = os_handle_pkg_change;
iface->handle_set_initramfs_state = os_handle_set_initramfs_state;
iface->handle_cleanup = os_handle_cleanup;
- iface->handle_live_fs = os_handle_live_fs;
iface->handle_get_cached_rebase_rpm_diff = os_handle_get_cached_rebase_rpm_diff;
iface->handle_download_rebase_rpm_diff = os_handle_download_rebase_rpm_diff;
iface->handle_get_cached_deploy_rpm_diff = os_handle_get_cached_deploy_rpm_diff;