+ screen->autoboot_enabled = config->autoboot_enabled;
+
+ screen->widgets.autoboot_l = widget_new_label(set, 0, 0,
+ _("Autoboot:"));
+ screen->widgets.autoboot_f = widget_new_select(set, 0, 0,
+ COLS - screen->field_x - 1);
+
+ widget_select_add_option(screen->widgets.autoboot_f, 0, _("Disabled"),
+ !screen->autoboot_enabled);
+ widget_select_add_option(screen->widgets.autoboot_f, 1, _("Enabled"),
+ screen->autoboot_enabled);
+
+ widget_select_on_change(screen->widgets.autoboot_f,
+ config_screen_autoboot_change, screen);
+
+ add_len = max(min_len, strncols(_("Add Device")));
+ clear_len = max(min_len, strncols(_("Clear")));
+ any_len = max(min_len, strncols(_("Clear & Boot Any")));
+
+ screen->widgets.boot_add_b = widget_new_button(set, 0, 0, add_len,
+ _("Add Device"),
+ config_screen_add_device, screen);
+
+ screen->widgets.boot_none_b = widget_new_button(set, 0, 0, clear_len,
+ _("Clear"),
+ config_screen_autoboot_none, screen);
+
+ screen->widgets.boot_any_b = widget_new_button(set, 0, 0, any_len,
+ _("Clear & Boot Any"),
+ config_screen_autoboot_any, screen);
+
+ screen->widgets.boot_order_l = widget_new_label(set, 0, 0,
+ _("Boot Order:"));
+ screen->widgets.boot_order_f = widget_new_subset(set, 0, 0,
+ COLS - screen->field_x,
+ config_screen_update_subset);
+ screen->widgets.boot_empty_l = widget_new_label(set, 0, 0,
+ _("(None)"));
+
+ widget_subset_on_change(screen->widgets.boot_order_f,
+ config_screen_boot_order_change, screen);
+
+ for (i = 0; i < sysinfo->n_blockdevs; i++) {
+ struct blockdev_info *bd = sysinfo->blockdevs[i];
+
+ label = talloc_asprintf(screen, _("disk: %s [uuid: %s]"),
+ bd->name, bd->uuid);
+
+ widget_subset_add_option(screen->widgets.boot_order_f, label);
+ }
+
+ for (i = 0; i < sysinfo->n_interfaces; i++) {
+ struct interface_info *info = sysinfo->interfaces[i];
+ char mac[20];
+
+ mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac));
+
+ label = talloc_asprintf(screen, _("net: %s [mac: %s]"),
+ info->name, mac);
+
+ widget_subset_add_option(screen->widgets.boot_order_f, label);
+ }
+
+ for (i = DEVICE_TYPE_NETWORK; i < DEVICE_TYPE_UNKNOWN; i++) {
+
+ if (i == DEVICE_TYPE_ANY)
+ label = talloc_asprintf(screen, _("Any Device"));
+ else
+ label = talloc_asprintf(screen, _("Any %s device"),
+ device_type_display_name(i));
+
+ widget_subset_add_option(screen->widgets.boot_order_f, label);
+ }
+
+ for (i = 0; i < config->n_autoboot_opts; i++) {
+ struct autoboot_option *opt = &config->autoboot_opts[i];
+ int idx;
+
+ idx = find_autoboot_idx(sysinfo, opt);
+
+ if (idx >= 0) {
+ widget_subset_make_active(screen->widgets.boot_order_f,
+ idx);
+ } else {
+ if (opt->boot_type == BOOT_DEVICE_TYPE)
+ pb_log("%s: Unknown autoboot option: %d\n",
+ __func__, opt->type);
+ else
+ pb_log("%s: Unknown autoboot UUID: %s\n",
+ __func__, opt->uuid);
+ }
+ }
+