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));
|
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 */
|
/* save the device state for other applications to see */
|
||||||
if (!fu_util_save_current_state (priv, error))
|
if (!fu_util_save_current_state (priv, error))
|
||||||
return FALSE;
|
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;
|
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? */
|
/* nag? */
|
||||||
if (!fu_util_perhaps_show_unreported (priv, error))
|
if (!fu_util_perhaps_show_unreported (priv, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1452,11 +1449,21 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
|
|||||||
/* no devices supported by LVFS or all are filtered */
|
/* no devices supported by LVFS or all are filtered */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_NOTHING_TO_DO,
|
FWUPD_ERROR_NOTHING_TO_DO,
|
||||||
"No updatable devices");
|
"No updatable devices");
|
||||||
return FALSE;
|
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 */
|
/* success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user