"petitboot,bootdevs",
"petitboot,language",
"petitboot,debug?",
+ "petitboot,write?",
NULL,
};
val = get_param(platform, "petitboot,debug?");
config->debug = val && !strcmp(val, "true");
}
+
+ val = get_param(platform, "petitboot,write?");
+ if (val)
+ config->allow_writes = !strcmp(val, "true");
}
static char *iface_config_str(void *ctx, struct interface_config *config)
val = config->lang ?: "";
update_string_config(platform, "petitboot,language", val);
+ if (config->allow_writes == defaults->allow_writes)
+ val = "";
+ else
+ val = config->allow_writes ? "true" : "false";
+ update_string_config(platform, "petitboot,write?", val);
+
update_network_config(platform, config);
update_bootdev_config(platform, config);
len += 4 + 4; /* ipmi_bootdev, ipmi_bootdev_persistent */
+ len += 4; /* allow_writes */
+
len += 4 + optional_strlen(config->lang);
return len;
*(uint32_t *)pos = config->ipmi_bootdev_persistent;
pos += 4;
+ *(uint32_t *)pos = config->allow_writes;
+ pos += 4;
+
pos += pb_protocol_serialise_string(pos, config->lang);
assert(pos <= buf + buf_len);
goto out;
config->ipmi_bootdev_persistent = !!tmp;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->allow_writes = !!tmp;
+
if (read_string(config, &pos, &len, &str))
goto out;
#include "nc-config.h"
#include "nc-widgets.h"
-#define N_FIELDS 32
+#define N_FIELDS 34
extern struct help_text config_help_text;
struct nc_widget_label *dns_dhcp_help_l;
struct nc_widget_label *dns_help_l;
+ struct nc_widget_label *allow_write_l;
+ struct nc_widget_select *allow_write_f;
+
struct nc_widget_label *safe_mode;
struct nc_widget_button *ok_b;
struct nc_widget_button *help_b;
struct config *config;
int i, n_boot_opts, rc, idx;
unsigned int *order;
+ bool allow_write;
char mac[20];
config = config_copy(screen, screen->cui->config);
}
}
+ allow_write = widget_select_get_value(screen->widgets.allow_write_f);
+ if (allow_write != config->allow_writes)
+ config->allow_writes = allow_write;
+
config->safe_mode = false;
rc = cui_send_config(screen->cui, config);
talloc_free(config);
y += 1;
}
+ layout_pair(screen, y, screen->widgets.allow_write_l,
+ widget_select_base(screen->widgets.allow_write_f));
+ y += widget_height(widget_select_base(screen->widgets.allow_write_f));
+
+ y += 1;
+
widget_move(widget_button_base(screen->widgets.ok_b),
y, screen->field_x);
widget_move(widget_button_base(screen->widgets.help_b),
screen->widgets.safe_mode = widget_new_label(set, 0, 0,
_("Selecting 'OK' will exit safe mode"));
+ screen->widgets.allow_write_l = widget_new_label(set, 0, 0,
+ _("Disk R/W:"));
+ screen->widgets.allow_write_f = widget_new_select(set, 0, 0,
+ COLS - screen->field_x);
+
+ widget_select_add_option(screen->widgets.allow_write_f, 0,
+ _("Prevent all writes to disk"),
+ !config->allow_writes);
+ widget_select_add_option(screen->widgets.allow_write_f, 1,
+ _("Allow bootloader scripts to modify disks"),
+ config->allow_writes);
+
screen->widgets.ok_b = widget_new_button(set, 0, 0, 6, _("OK"),
ok_click, screen);
screen->widgets.help_b = widget_new_button(set, 0, 0, 10, _("Help"),