From d122facc091c58b1026c2f4ae5dc6b2eb0e61c3b Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 2 Oct 2019 20:21:33 -0500 Subject: [PATCH] trivial: fu-util: show no updatable devices error for update command This makes it mirror the behavior of `get-updates` command. --- src/fu-util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fu-util.c b/src/fu-util.c index 5d2a2fbb3..8313c5b46 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -1811,6 +1811,7 @@ static gboolean fu_util_update_all (FuUtilPrivate *priv, GError **error) { g_autoptr(GPtrArray) devices = NULL; + gboolean supported = FALSE; /* get devices from daemon */ devices = fwupd_client_get_devices (priv->client, NULL, error); @@ -1831,6 +1832,7 @@ fu_util_update_all (FuUtilPrivate *priv, GError **error) continue; if (!fu_util_filter_device (priv, dev)) continue; + supported = TRUE; /* get the releases for this device and filter for validity */ rels = fwupd_client_get_upgrades (priv->client, @@ -1853,6 +1855,15 @@ fu_util_update_all (FuUtilPrivate *priv, GError **error) return FALSE; } + /* no devices supported by LVFS or all are filtered */ + if (!supported) { + g_set_error_literal (error, + FWUPD_ERROR, + FWUPD_ERROR_NOTHING_TO_DO, + "No updatable devices"); + return FALSE; + } + /* we don't want to ask anything */ if (priv->no_reboot_check) { g_debug ("skipping reboot check");