X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-config.c;h=834962968ca04328f13112b03d81d5488703649c;hp=c668bde12ae0255ceba9a73d4034abccc0b04cf1;hb=5b3dd56d982629349e612b9e984e65dec09b438f;hpb=9f42e56fc5968fcb34edfad017adb73960c2bb61 diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index c668bde..8349629 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -33,7 +33,7 @@ #include "nc-config.h" #include "nc-widgets.h" -#define N_FIELDS 44 +#define N_FIELDS 48 extern struct help_text config_help_text; @@ -106,11 +106,16 @@ struct config_screen { struct nc_widget_textbox *dns_f; struct nc_widget_label *dns_dhcp_help_l; struct nc_widget_label *dns_help_l; + struct nc_widget_label *http_proxy_l; + struct nc_widget_textbox *http_proxy_f; + struct nc_widget_label *https_proxy_l; + struct nc_widget_textbox *https_proxy_f; struct nc_widget_label *allow_write_l; struct nc_widget_select *allow_write_f; struct nc_widget_label *boot_console_l; struct nc_widget_select *boot_console_f; + struct nc_widget_label *manual_console_l; struct nc_widget_label *current_console_l; struct nc_widget_label *net_override_l; @@ -334,11 +339,18 @@ static int screen_process_form(struct config_screen *screen) } } + talloc_free(config->http_proxy); + talloc_free(config->https_proxy); + str = widget_textbox_get_value(screen->widgets.http_proxy_f); + config->http_proxy = talloc_strdup(config, str); + str = widget_textbox_get_value(screen->widgets.https_proxy_f); + config->https_proxy = talloc_strdup(config, str); + allow_write = widget_select_get_value(screen->widgets.allow_write_f); if (allow_write != config->allow_writes) config->allow_writes = allow_write; - if (config->n_consoles) { + if (config->n_consoles && !config->manual_console) { idx = widget_select_get_value(screen->widgets.boot_console_f); if (!config->boot_console) { config->boot_console = talloc_strdup(config, @@ -584,6 +596,13 @@ static void config_screen_layout_widgets(struct config_screen *screen) y += 1; } + wf = widget_textbox_base(screen->widgets.http_proxy_f); + layout_pair(screen, y, screen->widgets.http_proxy_l, wf); + y++; + wf = widget_textbox_base(screen->widgets.https_proxy_f); + layout_pair(screen, y, screen->widgets.https_proxy_l, wf); + y++; + y += 1; layout_pair(screen, y, screen->widgets.allow_write_l, @@ -592,7 +611,15 @@ static void config_screen_layout_widgets(struct config_screen *screen) y += 1; - if (widget_height(widget_select_base(screen->widgets.boot_console_f))) { + if (screen->widgets.manual_console_l) { + layout_pair(screen, y++, screen->widgets.boot_console_l, + widget_label_base(screen->widgets.manual_console_l)); + widget_move(widget_label_base(screen->widgets.current_console_l), + y, screen->field_x); + widget_set_visible(widget_select_base( + screen->widgets.boot_console_f), false); + y += 2; + } else if (widget_height(widget_select_base(screen->widgets.boot_console_f))) { layout_pair(screen, y, screen->widgets.boot_console_l, widget_select_base(screen->widgets.boot_console_f)); y += widget_height(widget_select_base(screen->widgets.boot_console_f)); @@ -785,7 +812,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, { struct nc_widgetset *set = screen->widgetset; struct interface_config *ifcfg; - char *str, *ip, *mask, *gw, *url, *tty; + char *str, *ip, *mask, *gw, *url, *tty, *label; enum net_conf_type type; unsigned int i; int add_len, clear_len, any_len, min_len = 20; @@ -841,7 +868,6 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_blockdevs; i++) { struct blockdev_info *bd = sysinfo->blockdevs[i]; - char *label; label = talloc_asprintf(screen, _("disk: %s [uuid: %s]"), bd->name, bd->uuid); @@ -851,7 +877,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char *label, mac[20]; + char mac[20]; mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); @@ -862,7 +888,6 @@ static void config_screen_setup_widgets(struct config_screen *screen, } for (i = DEVICE_TYPE_NETWORK; i < DEVICE_TYPE_UNKNOWN; i++) { - char *label; if (i == DEVICE_TYPE_ANY) label = talloc_asprintf(screen, _("Any Device")); @@ -903,7 +928,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, widget_textbox_set_validator_integer(screen->widgets.timeout_f, 0, 999); if (config->ipmi_bootdev) { - char *label = talloc_asprintf(screen, + label = talloc_asprintf(screen, _("%s IPMI boot option: %s"), config->ipmi_bootdev_persistent ? "Persistent" : "Temporary", @@ -1021,6 +1046,15 @@ static void config_screen_setup_widgets(struct config_screen *screen, screen->widgets.dns_dhcp_help_l = widget_new_label(set, 0, 0, _("(if not provided by DHCP server)")); + screen->widgets.http_proxy_l = widget_new_label(set, 0, 0, + _("HTTP Proxy:")); + screen->widgets.http_proxy_f = widget_new_textbox(set, 0, 0, 32, + config->http_proxy); + screen->widgets.https_proxy_l = widget_new_label(set, 0, 0, + _("HTTPS Proxy:")); + screen->widgets.https_proxy_f = widget_new_textbox(set, 0, 0, 32, + config->https_proxy); + if (config->safe_mode) screen->widgets.safe_mode = widget_new_label(set, 0, 0, _("Selecting 'OK' will exit safe mode")); @@ -1051,6 +1085,12 @@ static void config_screen_setup_widgets(struct config_screen *screen, config->consoles[i], found); } + if (config->manual_console) { + label = talloc_asprintf(screen, _("Manually set: '%s'"), + config->boot_console); + screen->widgets.manual_console_l = widget_new_label(set, 0, 0, label); + } + tty = talloc_asprintf(screen, _("Current interface: %s"), ttyname(STDIN_FILENO)); screen->widgets.current_console_l = widget_new_label(set, 0 , 0, tty);