diff --git a/src/app/rpmostree-dbus-helpers.c b/src/app/rpmostree-dbus-helpers.c index 083c69a3..9a6a8fa4 100644 --- a/src/app/rpmostree-dbus-helpers.c +++ b/src/app/rpmostree-dbus-helpers.c @@ -489,6 +489,7 @@ rpmostree_transaction_get_response_sync (RPMOSTreeSysroot *sysroot_proxy, gint cancel_handler; gulong signal_handler = 0; gboolean success = FALSE; + gboolean just_started = FALSE; connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (sysroot_proxy)); @@ -544,10 +545,21 @@ rpmostree_transaction_get_response_sync (RPMOSTreeSysroot *sysroot_proxy, /* Tell the server we're ready to receive signals. */ if (!rpmostree_transaction_call_start_sync (transaction, + &just_started, cancellable, error)) goto out; + /* FIXME Use the 'just_started' flag to determine whether to print + * a message about reattaching to an in-progress transaction, + * like: + * + * Existing upgrade in progress, reattaching. Control-C to cancel. + * + * But that requires having a printable description of the + * operation. Maybe just add a string arg to this function? + */ + g_main_loop_run (tp->loop); g_cancellable_disconnect (cancellable, cancel_handler); diff --git a/src/daemon/org.projectatomic.rpmostree1.xml b/src/daemon/org.projectatomic.rpmostree1.xml index 1502ca90..10f25d54 100644 --- a/src/daemon/org.projectatomic.rpmostree1.xml +++ b/src/daemon/org.projectatomic.rpmostree1.xml @@ -106,8 +106,13 @@ - - + + + + diff --git a/src/daemon/rpmostreed-transaction.c b/src/daemon/rpmostreed-transaction.c index 56ad25c0..8aa3159f 100644 --- a/src/daemon/rpmostreed-transaction.c +++ b/src/daemon/rpmostreed-transaction.c @@ -506,6 +506,7 @@ transaction_handle_start (RPMOSTreeTransaction *transaction, { RpmostreedTransaction *self = RPMOSTREED_TRANSACTION (transaction); RpmostreedTransactionPrivate *priv = rpmostreed_transaction_get_private (self); + gboolean started = FALSE; /* The bus name watch ID doubles as a "not-yet-started" flag. * Once started the transaction proceeds independently of the @@ -514,6 +515,8 @@ transaction_handle_start (RPMOSTreeTransaction *transaction, { GTask *task; + started = TRUE; + g_debug ("%s (%p): Started", G_OBJECT_TYPE_NAME (self), self); g_bus_unwatch_name (priv->watch_id); @@ -525,16 +528,9 @@ transaction_handle_start (RPMOSTreeTransaction *transaction, NULL); g_task_run_in_thread (task, transaction_execute_thread); g_object_unref (task); + } - rpmostree_transaction_complete_start (transaction, invocation); - } - else - { - g_dbus_method_invocation_return_error (invocation, - RPM_OSTREED_ERROR, - RPM_OSTREED_ERROR_FAILED, - "Transaction has already started"); - } + rpmostree_transaction_complete_start (transaction, invocation, started); return TRUE; }