trivial: Do not recover the pending update if the boot time is unchanged

This ensures we can restart the fwupd service without marking updates that need
a reboot as failed.
This commit is contained in:
Richard Hughes 2018-01-12 09:49:05 +00:00
parent 59c2ebe5cd
commit f271142c47

View File

@ -3319,6 +3319,7 @@ fu_engine_update_history_device (FuEngine *self, FuDevice *dev_history, GError *
FuDevice *dev;
FuPlugin *plugin;
FwupdRelease *rel_history;
g_autofree gchar *btime = NULL;
/* is in the device list */
dev = fu_device_list_find_by_id (self->device_list,
@ -3338,6 +3339,15 @@ fu_engine_update_history_device (FuEngine *self, FuDevice *dev_history, GError *
return FALSE;
}
/* is this the same boot time as when we scheduled the update,
* i.e. has fwupd been restarted before we rebooted */
btime = fu_engine_get_boot_time ();
if (g_strcmp0 (fwupd_release_get_metadata_item (rel_history, "BootTime"),
btime) == 0) {
g_debug ("service restarted, but no reboot has taken place");
return TRUE;
}
/* the system is running with the new firmware version */
if (g_strcmp0 (fu_device_get_version (dev),
fwupd_release_get_version (rel_history)) == 0) {