mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 06:14:03 +00:00
Add a verify-update command to fwupdtool
This is useful for debugging to just read the checksum from the device.
This commit is contained in:
parent
11f612c1d3
commit
1568449e69
@ -15,6 +15,7 @@ _fwupdtool_cmd_list=(
|
|||||||
'smbios-dump'
|
'smbios-dump'
|
||||||
'attach'
|
'attach'
|
||||||
'detach'
|
'detach'
|
||||||
|
'verify-update'
|
||||||
'watch'
|
'watch'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ _fwupdtool()
|
|||||||
_show_modifiers
|
_show_modifiers
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
attach|detach|activate)
|
attach|detach|activate|verify-update)
|
||||||
if [[ "$prev" = "$command" ]]; then
|
if [[ "$prev" = "$command" ]]; then
|
||||||
_show_device_ids
|
_show_device_ids
|
||||||
#modifiers
|
#modifiers
|
||||||
|
@ -1253,6 +1253,37 @@ fu_util_monitor (FuUtilPrivate *priv, gchar **values, GError **error)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
fu_util_verify_update (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||||
|
{
|
||||||
|
g_autofree gchar *str = NULL;
|
||||||
|
g_autoptr(FuDevice) dev = NULL;
|
||||||
|
|
||||||
|
/* load engine */
|
||||||
|
if (!fu_util_start_engine (priv, FU_ENGINE_LOAD_FLAG_NONE, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* get device */
|
||||||
|
if (g_strv_length (values) == 1) {
|
||||||
|
dev = fu_engine_get_device (priv->engine, values[1], error);
|
||||||
|
if (dev == NULL)
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
dev = fu_util_prompt_for_device (priv, error);
|
||||||
|
if (dev == NULL)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add checksums */
|
||||||
|
if (!fu_engine_verify_update (priv->engine, fu_device_get_id (dev), error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* show checksums */
|
||||||
|
str = fu_device_to_string (dev);
|
||||||
|
g_print ("%s\n", str);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -1419,6 +1450,12 @@ main (int argc, char *argv[])
|
|||||||
/* TRANSLATORS: command description */
|
/* TRANSLATORS: command description */
|
||||||
_("Sign data using the client certificate"),
|
_("Sign data using the client certificate"),
|
||||||
fu_util_self_sign);
|
fu_util_self_sign);
|
||||||
|
fu_util_cmd_array_add (cmd_array,
|
||||||
|
"verify-update",
|
||||||
|
"[DEVICE_ID]",
|
||||||
|
/* TRANSLATORS: command description */
|
||||||
|
_("Update the stored metadata with current contents"),
|
||||||
|
fu_util_verify_update);
|
||||||
|
|
||||||
/* do stuff on ctrl+c */
|
/* do stuff on ctrl+c */
|
||||||
priv->cancellable = g_cancellable_new ();
|
priv->cancellable = g_cancellable_new ();
|
||||||
|
Loading…
Reference in New Issue
Block a user