[gnome-software] fwupd: Download the firmware update manually if not yet downloaded
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] fwupd: Download the firmware update manually if not yet downloaded
- Date: Fri, 21 Oct 2016 15:43:50 +0000 (UTC)
commit 8712ae177ee3cdb7f71ae1770a8d259816ccf565
Author: Richard Hughes <richard hughsie com>
Date: Fri Oct 21 16:32:23 2016 +0100
fwupd: Download the firmware update manually if not yet downloaded
There is no way this can happen right now, but in the future...
src/plugins/gs-plugin-fwupd.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 93985e4..a888f04 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -424,6 +424,8 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
if (fwupd_result_get_update_uri (res) != NULL) {
gs_app_set_origin_hostname (app,
fwupd_result_get_update_uri (res));
+ gs_app_set_metadata (app, "fwupd::UpdateURI",
+ fwupd_result_get_update_uri (res));
}
if (fwupd_result_get_device_description (res) != NULL) {
g_autofree gchar *tmp = NULL;
@@ -807,10 +809,12 @@ gs_plugin_fwupd_install (GsPlugin *plugin,
GsPluginData *priv = gs_plugin_get_data (plugin);
const gchar *device_id;
FwupdInstallFlags install_flags = 0;
+ GFile *local_file;
g_autofree gchar *filename = NULL;
/* not set */
- if (gs_app_get_local_file (app) == NULL) {
+ local_file = gs_app_get_local_file (app);
+ if (local_file == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
@@ -818,7 +822,15 @@ gs_plugin_fwupd_install (GsPlugin *plugin,
filename);
return FALSE;
}
- filename = g_file_get_path (gs_app_get_local_file (app));
+
+ /* file does not yet exist */
+ filename = g_file_get_path (local_file);
+ if (!g_file_query_exists (local_file, cancellable)) {
+ const gchar *uri = gs_app_get_metadata_item (app, "fwupd::UpdateURI");
+ if (!gs_plugin_download_file (plugin, app, uri, filename,
+ cancellable, error))
+ return FALSE;
+ }
/* limit to single device? */
device_id = gs_app_get_metadata_item (app, "fwupd::DeviceID");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]