mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-09 21:08:29 +00:00
Add a command 'clear-offline' to fwupdmgr
This allows us to 'unschedule' any offline updates.
This commit is contained in:
parent
f6e4d723ca
commit
31bbd1691b
@ -185,6 +185,35 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
fu_pending_remove_all (FuPending *pending, GError **error)
|
||||||
|
{
|
||||||
|
FuPendingPrivate *priv = GET_PRIVATE (pending);
|
||||||
|
char *error_msg = NULL;
|
||||||
|
gint rc;
|
||||||
|
|
||||||
|
g_return_val_if_fail (FU_IS_PENDING (pending), FALSE);
|
||||||
|
|
||||||
|
/* lazy load */
|
||||||
|
if (priv->db == NULL) {
|
||||||
|
if (!fu_pending_load (pending, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remove entries */
|
||||||
|
g_debug ("FuPending: removing all devices");
|
||||||
|
rc = sqlite3_exec (priv->db, "DELETE FROM pending;", NULL, NULL, &error_msg);
|
||||||
|
if (rc != SQLITE_OK) {
|
||||||
|
g_set_error (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_WRITE,
|
||||||
|
"SQL error: %s", error_msg);
|
||||||
|
sqlite3_free (error_msg);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_pending_remove_device (FuPending *pending, FwupdResult *res, GError **error)
|
fu_pending_remove_device (FuPending *pending, FwupdResult *res, GError **error)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,8 @@ gboolean fu_pending_set_error_msg (FuPending *pending,
|
|||||||
gboolean fu_pending_remove_device (FuPending *pending,
|
gboolean fu_pending_remove_device (FuPending *pending,
|
||||||
FwupdResult *res,
|
FwupdResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
gboolean fu_pending_remove_all (FuPending *pending,
|
||||||
|
GError **error);
|
||||||
FwupdResult *fu_pending_get_device (FuPending *pending,
|
FwupdResult *fu_pending_get_device (FuPending *pending,
|
||||||
const gchar *device_id,
|
const gchar *device_id,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
@ -557,6 +557,13 @@ fu_util_clear_results (FuUtilPrivate *priv, gchar **values, GError **error)
|
|||||||
return fwupd_client_clear_results (priv->client, values[0], NULL, error);
|
return fwupd_client_clear_results (priv->client, values[0], NULL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
fu_util_clear_offline (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(FuPending) pending = fu_pending_new ();
|
||||||
|
return fu_pending_remove_all (pending, error);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_util_verify_update_all (FuUtilPrivate *priv, GError **error)
|
fu_util_verify_update_all (FuUtilPrivate *priv, GError **error)
|
||||||
{
|
{
|
||||||
@ -1705,6 +1712,12 @@ main (int argc, char *argv[])
|
|||||||
/* TRANSLATORS: command description */
|
/* TRANSLATORS: command description */
|
||||||
_("Clears the results from the last update"),
|
_("Clears the results from the last update"),
|
||||||
fu_util_clear_results);
|
fu_util_clear_results);
|
||||||
|
fu_util_add (priv->cmd_array,
|
||||||
|
"clear-offline",
|
||||||
|
NULL,
|
||||||
|
/* TRANSLATORS: command description */
|
||||||
|
_("Clears any updates scheduled to be updated offline"),
|
||||||
|
fu_util_clear_offline);
|
||||||
fu_util_add (priv->cmd_array,
|
fu_util_add (priv->cmd_array,
|
||||||
"get-results",
|
"get-results",
|
||||||
NULL,
|
NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user