summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-08-09 16:16:48 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-08 14:26:27 +1000
commitd9e70bb63227a683f808a21be20b3d5e1a474f95 (patch)
tree7ff86e842006776e1f124ec1397e28567d39aabf /ui
parent9f42e56fc5968fcb34edfad017adb73960c2bb61 (diff)
downloadtalos-petitboot-d9e70bb63227a683f808a21be20b3d5e1a474f95.tar.gz
talos-petitboot-d9e70bb63227a683f808a21be20b3d5e1a474f95.zip
Consolidate petitboot,tty and petitboot,console
Commit ce54f86 "Add petitboot,tty and track available consoles" added the petitboot,tty parameter, but the petitboot,console parameter is also recognised by Petitboot. These are ultimately handled by the 30-add-offb and 80-set-stdout hooks respectively, but exist for mostly the same purpose. We consolidate these down to just the original petitboot,console parameter. If the contents of petitboot,console have been configured by Petitboot (ie. it is of the form /dev/dev# [ Description ]) we behave as normal, otherwise we assume that petitboot,console contains a full OF path to the intended console device and do not allow it to be modified. This follows petitboot,console's original intent to be a debug aid, and takes precedence over any other use. The 80-set-stdout hook is removed as 30-add-offb now accounts for both use cases. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/ncurses/nc-config.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index c668bde..1bc77e8 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -111,6 +111,7 @@ struct config_screen {
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;
@@ -338,7 +339,7 @@ static int screen_process_form(struct config_screen *screen)
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,
@@ -592,7 +593,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 +794,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 +850,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 +859,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 +870,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 +910,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",
@@ -1051,6 +1058,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);
OpenPOWER on IntegriCloud