summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2018-07-03 16:34:47 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-07-10 13:46:12 +1000
commit99a1f905f585480cca2c9a43ab18ed8e37365192 (patch)
tree9839c5ce9a791cd206388f81d3a844ba82965ff7 /discover
parent47c55b245aab729a9c23bfb830329022c7b25d83 (diff)
downloadtalos-petitboot-99a1f905f585480cca2c9a43ab18ed8e37365192.tar.gz
talos-petitboot-99a1f905f585480cca2c9a43ab18ed8e37365192.zip
ui/ncurses: Implement F10-F12 for autoboot device control
Add a few mappings to specify temporary autoboot settings: F10: Only autoboot from disk F11: Only autoboot from USB devices F12: Only autoboot from network These use the new code to prevent cancelling autoboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index b8e9330..72dda75 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -935,13 +935,38 @@ static void set_default(struct device_handler *handler,
default_timeout(handler);
}
+static char *autoboot_option_desc(void *ctx, const struct autoboot_option *opt)
+{
+ const char *type, *val;
+
+ if (opt->boot_type == BOOT_DEVICE_TYPE) {
+ type = _("device type");
+ val = device_type_display_name(opt->type);
+ } else if (opt->boot_type == BOOT_DEVICE_UUID) {
+ type = _("device UUID");
+ val = opt->uuid;
+ } else {
+ type = _("unknown specifier");
+ val = NULL;
+ }
+
+ return talloc_asprintf(ctx, "%s = %s", type, val);
+}
+
void device_handler_apply_temp_autoboot(struct device_handler *handler,
struct autoboot_option *opt)
{
unsigned int i;
+ char *desc;
handler->temp_autoboot = talloc_steal(handler, opt);
+ desc = autoboot_option_desc(handler, opt);
+ device_handler_status_info(handler,
+ _("Applying temporary autoboot override: %s"),
+ desc);
+ talloc_free(desc);
+
if (!handler->autoboot_enabled)
return;
OpenPOWER on IntegriCloud