mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 14:22:13 +00:00
Add CLI support for disabling device prompting
This commit is contained in:
parent
f3a13f89dd
commit
b0ccd1f4e2
@ -66,6 +66,7 @@ struct FuUtilPrivate {
|
|||||||
gboolean as_json;
|
gboolean as_json;
|
||||||
gboolean no_reboot_check;
|
gboolean no_reboot_check;
|
||||||
gboolean no_safety_check;
|
gboolean no_safety_check;
|
||||||
|
gboolean no_device_prompt;
|
||||||
gboolean prepare_blob;
|
gboolean prepare_blob;
|
||||||
gboolean cleanup_blob;
|
gboolean cleanup_blob;
|
||||||
gboolean enable_json_state;
|
gboolean enable_json_state;
|
||||||
@ -534,6 +535,15 @@ fu_util_prompt_for_device(FuUtilPrivate *priv, GPtrArray *devices_opt, GError **
|
|||||||
return g_object_ref(dev);
|
return g_object_ref(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no questions */
|
||||||
|
if (priv->no_device_prompt) {
|
||||||
|
g_set_error_literal(error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_NOT_FOUND,
|
||||||
|
"can't prompt for devices");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* TRANSLATORS: get interactive prompt */
|
/* TRANSLATORS: get interactive prompt */
|
||||||
g_print("%s\n", _("Choose a device:"));
|
g_print("%s\n", _("Choose a device:"));
|
||||||
/* TRANSLATORS: this is to abort the interactive prompt */
|
/* TRANSLATORS: this is to abort the interactive prompt */
|
||||||
@ -3219,6 +3229,14 @@ main(int argc, char *argv[])
|
|||||||
/* TRANSLATORS: command line option */
|
/* TRANSLATORS: command line option */
|
||||||
N_("Do not perform device safety checks"),
|
N_("Do not perform device safety checks"),
|
||||||
NULL},
|
NULL},
|
||||||
|
{"no-device-prompt",
|
||||||
|
'\0',
|
||||||
|
0,
|
||||||
|
G_OPTION_ARG_NONE,
|
||||||
|
&priv->no_device_prompt,
|
||||||
|
/* TRANSLATORS: command line option */
|
||||||
|
N_("Do not prompt for devices"),
|
||||||
|
NULL},
|
||||||
{"show-all",
|
{"show-all",
|
||||||
'\0',
|
'\0',
|
||||||
0,
|
0,
|
||||||
@ -3618,6 +3636,7 @@ main(int argc, char *argv[])
|
|||||||
g_debug("failed to initialize interactive console: %s", error_console->message);
|
g_debug("failed to initialize interactive console: %s", error_console->message);
|
||||||
priv->no_reboot_check = TRUE;
|
priv->no_reboot_check = TRUE;
|
||||||
priv->no_safety_check = TRUE;
|
priv->no_safety_check = TRUE;
|
||||||
|
priv->no_device_prompt = TRUE;
|
||||||
} else {
|
} else {
|
||||||
priv->interactive = TRUE;
|
priv->interactive = TRUE;
|
||||||
/* set our implemented feature set */
|
/* set our implemented feature set */
|
||||||
|
@ -62,6 +62,7 @@ struct FuUtilPrivate {
|
|||||||
gboolean no_reboot_check;
|
gboolean no_reboot_check;
|
||||||
gboolean no_unreported_check;
|
gboolean no_unreported_check;
|
||||||
gboolean no_safety_check;
|
gboolean no_safety_check;
|
||||||
|
gboolean no_device_prompt;
|
||||||
gboolean assume_yes;
|
gboolean assume_yes;
|
||||||
gboolean sign;
|
gboolean sign;
|
||||||
gboolean show_all;
|
gboolean show_all;
|
||||||
@ -211,6 +212,15 @@ fu_util_prompt_for_device(FuUtilPrivate *priv, GPtrArray *devices, GError **erro
|
|||||||
return g_object_ref(dev);
|
return g_object_ref(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no questions */
|
||||||
|
if (priv->no_device_prompt) {
|
||||||
|
g_set_error_literal(error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_NOT_FOUND,
|
||||||
|
"can't prompt for devices ");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* TRANSLATORS: get interactive prompt */
|
/* TRANSLATORS: get interactive prompt */
|
||||||
g_print("%s\n", _("Choose a device:"));
|
g_print("%s\n", _("Choose a device:"));
|
||||||
/* TRANSLATORS: this is to abort the interactive prompt */
|
/* TRANSLATORS: this is to abort the interactive prompt */
|
||||||
@ -3890,6 +3900,14 @@ main(int argc, char *argv[])
|
|||||||
/* TRANSLATORS: command line option */
|
/* TRANSLATORS: command line option */
|
||||||
N_("Do not perform device safety checks"),
|
N_("Do not perform device safety checks"),
|
||||||
NULL},
|
NULL},
|
||||||
|
{"no-device-prompt",
|
||||||
|
'\0',
|
||||||
|
0,
|
||||||
|
G_OPTION_ARG_NONE,
|
||||||
|
&priv->no_device_prompt,
|
||||||
|
/* TRANSLATORS: command line option */
|
||||||
|
N_("Do not prompt for devices"),
|
||||||
|
NULL},
|
||||||
{"no-history",
|
{"no-history",
|
||||||
'\0',
|
'\0',
|
||||||
0,
|
0,
|
||||||
@ -4259,6 +4277,7 @@ main(int argc, char *argv[])
|
|||||||
priv->no_reboot_check = TRUE;
|
priv->no_reboot_check = TRUE;
|
||||||
priv->no_safety_check = TRUE;
|
priv->no_safety_check = TRUE;
|
||||||
priv->no_remote_check = TRUE;
|
priv->no_remote_check = TRUE;
|
||||||
|
priv->no_device_prompt = TRUE;
|
||||||
} else {
|
} else {
|
||||||
is_interactive = TRUE;
|
is_interactive = TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user