mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-22 21:52:49 +00:00
fwupdtool/fwupdmgr: make return code different for get-updates with no updates
This allows other tools to depend on it when checking for updates rather than reading the output.
This commit is contained in:
parent
406025ba56
commit
e8946a74d1
@ -485,13 +485,20 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
g_node_append_data (child, g_object_ref (rel));
|
||||
}
|
||||
}
|
||||
if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1)
|
||||
fu_util_print_tree (root, title);
|
||||
/* save the device state for other applications to see */
|
||||
if (!fu_util_save_current_state (priv, error))
|
||||
return FALSE;
|
||||
|
||||
/* success */
|
||||
/* updates */
|
||||
if (g_node_n_nodes (root, G_TRAVERSE_ALL) <= 1) {
|
||||
g_set_error_literal (error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_NOTHING_TO_DO,
|
||||
"No updates available for remaining devices");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fu_util_print_tree (root, title);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1442,9 +1442,6 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1)
|
||||
fu_util_print_tree (root, title);
|
||||
|
||||
/* nag? */
|
||||
if (!fu_util_perhaps_show_unreported (priv, error))
|
||||
return FALSE;
|
||||
@ -1457,6 +1454,16 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
"No updatable devices");
|
||||
return FALSE;
|
||||
}
|
||||
/* no updates available */
|
||||
if (g_node_n_nodes (root, G_TRAVERSE_ALL) <= 1) {
|
||||
g_set_error_literal (error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_NOTHING_TO_DO,
|
||||
"No updates available for remaining devices");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fu_util_print_tree (root, title);
|
||||
|
||||
/* success */
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user