From f271142c47feb7286bf1ff56a1a4a4ea03e0c747 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 12 Jan 2018 09:49:05 +0000 Subject: [PATCH] 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. --- src/fu-engine.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/fu-engine.c b/src/fu-engine.c index 3ded4fb85..dad398968 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -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) {