mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-10 18:12:35 +00:00
Do not update the MOTD during a composite update
This commit is contained in:
parent
73ac9d2e0b
commit
3aa7a703a8
@ -167,6 +167,12 @@ fu_engine_update_motd_timeout_cb(gpointer user_data)
|
||||
{
|
||||
FuEngine *self = FU_ENGINE(user_data);
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
|
||||
/* busy */
|
||||
if (fu_idle_has_inhibit(self->idle, "update"))
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
||||
/* update now */
|
||||
if (!fu_engine_update_motd(self, &error_local))
|
||||
g_debug("failed to update MOTD: %s", error_local->message);
|
||||
self->update_motd_id = 0;
|
||||
|
@ -148,6 +148,23 @@ fu_idle_inhibit(FuIdle *self, const gchar *reason)
|
||||
return item->token;
|
||||
}
|
||||
|
||||
gboolean
|
||||
fu_idle_has_inhibit(FuIdle *self, const gchar *reason)
|
||||
{
|
||||
g_autoptr(GRWLockWriterLocker) locker = g_rw_lock_reader_locker_new(&self->items_mutex);
|
||||
|
||||
g_return_val_if_fail(FU_IS_IDLE(self), FALSE);
|
||||
g_return_val_if_fail(reason != NULL, FALSE);
|
||||
g_return_val_if_fail(locker != NULL, FALSE);
|
||||
|
||||
for (guint i = 0; i < self->items->len; i++) {
|
||||
FuIdleItem *item = g_ptr_array_index(self->items, i);
|
||||
if (g_strcmp0(item->reason, reason) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
fu_idle_set_timeout(FuIdle *self, guint timeout)
|
||||
{
|
||||
|
@ -15,6 +15,8 @@ FuIdle *
|
||||
fu_idle_new(void);
|
||||
guint32
|
||||
fu_idle_inhibit(FuIdle *self, const gchar *reason);
|
||||
gboolean
|
||||
fu_idle_has_inhibit(FuIdle *self, const gchar *reason);
|
||||
void
|
||||
fu_idle_uninhibit(FuIdle *self, guint32 token);
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user