diff options
author | Brandon Carpenter <brandon.carpenter@pnnl.gov> | 2015-03-06 11:49:05 -0800 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2015-03-12 00:49:14 +0100 |
commit | 2fb51f9139ddeaa876337d2305f0bb482f58f1d0 (patch) | |
tree | 10c2fd2f68d302a10f30f35c52f9e7216fd0e1ff | |
parent | 2b217307e451b928df060e4850818e7585cbc458 (diff) |
Add 'editing disable' loader option to globally disallow option editing.
-rw-r--r-- | src/efi/gummiboot.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 4e71ca6..0297236 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -84,6 +84,7 @@ typedef struct { CHAR16 *entry_oneshot; CHAR16 *options_edit; CHAR16 *entries_auto; + BOOLEAN disable_edit; } Config; static VOID cursor_left(UINTN *cursor, UINTN *first) @@ -458,6 +459,7 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag config->background->Red, config->background->Green, config->background->Blue); + Print(L"editing %s\n", config->disable_edit ? L"disabled" : L"enabled"); Print(L"\n"); Print(L"config entry count: %d\n", config->entry_count); @@ -846,7 +848,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, EFI_FILE *ro case KEYPRESS(0, 0, 'e'): /* only the options of configured entries can be edited */ - if (config->entries[idx_highlight]->type == LOADER_UNDEFINED) + if (config->disable_edit || config->entries[idx_highlight]->type == LOADER_UNDEFINED) break; uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK); uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, y_max-1); @@ -1113,6 +1115,14 @@ static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) { config->background->Blue = xtoi(c); continue; } + + if (strcmpa((CHAR8 *)"editing", key) == 0) { + if (strcmpa((CHAR8 *)"enable", value) == 0 || strcmpa((CHAR8 *)"enabled", value) == 0) + config->disable_edit = FALSE; + else if (strcmpa((CHAR8 *)"disable", value) == 0 || strcmpa((CHAR8 *)"disabled", value) == 0) + config->disable_edit = TRUE; + continue; + } } } |