mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 12:54:58 +00:00
Only show the CLI time remaining for predictable status phases
Fixes https://github.com/fwupd/fwupd/issues/4540
This commit is contained in:
parent
d599c90da0
commit
ab0c750bb2
@ -103,6 +103,22 @@ fu_progressbar_erase_line(FuProgressbar *self)
|
|||||||
g_print("\033[G");
|
g_print("\033[G");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_fu_status_is_predictable(FwupdStatus status)
|
||||||
|
{
|
||||||
|
if (status == FWUPD_STATUS_DEVICE_ERASE)
|
||||||
|
return TRUE;
|
||||||
|
if (status == FWUPD_STATUS_DEVICE_VERIFY)
|
||||||
|
return TRUE;
|
||||||
|
if (status == FWUPD_STATUS_DEVICE_READ)
|
||||||
|
return TRUE;
|
||||||
|
if (status == FWUPD_STATUS_DEVICE_WRITE)
|
||||||
|
return TRUE;
|
||||||
|
if (status == FWUPD_STATUS_DOWNLOADING)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_progressbar_estimate_ready(FuProgressbar *self, guint percentage)
|
fu_progressbar_estimate_ready(FuProgressbar *self, guint percentage)
|
||||||
{
|
{
|
||||||
@ -116,6 +132,10 @@ fu_progressbar_estimate_ready(FuProgressbar *self, guint percentage)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* allow-list things that make sense... */
|
||||||
|
if (!_fu_status_is_predictable(self->status))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
old = self->last_estimate;
|
old = self->last_estimate;
|
||||||
elapsed = g_timer_elapsed(self->time_elapsed, NULL);
|
elapsed = g_timer_elapsed(self->time_elapsed, NULL);
|
||||||
self->last_estimate = elapsed / percentage * (100 - percentage);
|
self->last_estimate = elapsed / percentage * (100 - percentage);
|
||||||
|
Loading…
Reference in New Issue
Block a user