From 7188e5b335e4950943b1796ec93e65e939c8d67d Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Tue, 14 Dec 2021 12:19:09 -0600 Subject: [PATCH] Add support to show curl/wget output from fwupdmgr/fwupdtool --- docs/env.md | 1 + src/fu-tool.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/env.md b/docs/env.md index b85d9d832..831a5e40a 100644 --- a/docs/env.md +++ b/docs/env.md @@ -15,6 +15,7 @@ with a non-standard filesystem layout. * `FWUPD_SUPPORTED` overrides the `-Dsupported_build` meson option at runtime * `FWUPD_VERBOSE` is set when running `--verbose` * `FWUPD_XMLB_VERBOSE` can be set to show Xmlb silo regeneration +* `FWUPD_DOWNLOAD_VERBOSE` can be used to show wget or curl output * standard glibc variables like `LANG` are also honored for CLI tools that are translated * libcurl respects the session proxy, e.g. `http_proxy`, `all_proxy`, `sftp_proxy` and `no_proxy` diff --git a/src/fu-tool.c b/src/fu-tool.c index d37308146..ebd5b9e85 100644 --- a/src/fu-tool.c +++ b/src/fu-tool.c @@ -1034,6 +1034,13 @@ fu_util_install_task_sort_cb(gconstpointer a, gconstpointer b) return fu_install_task_compare(task1, task2); } +static void +fu_util_stdout_cb(const gchar *line, gpointer user_data) +{ + if (g_getenv("FWUPD_DOWNLOAD_VERBOSE") != NULL) + g_debug("'%s'", line); +} + static gboolean fu_util_download_out_of_process(const gchar *uri, const gchar *fn, GError **error) { @@ -1048,7 +1055,7 @@ fu_util_download_out_of_process(const gchar *uri, const gchar *fn, GError **erro g_debug("%s", error_local->message); continue; } - return fu_common_spawn_sync(argv[i], NULL, NULL, 0, NULL, error); + return fu_common_spawn_sync(argv[i], fu_util_stdout_cb, NULL, 0, NULL, error); } g_set_error_literal(error, FWUPD_ERROR,