From: Andreas Reichel <andreas.reichel....@siemens.com> Design of the bg_setenv tool does not allow proper handling of global user variables at the moment. The tool must be re-designed to solve this.
This does not affect the API where this functionality is wanted by SWupdate. Users can set the variables on a per-config basis. Signed-off-by: Andreas Reichel <andreas.reichel....@siemens.com> --- docs/TOOLS.md | 9 +++++++++ tools/bg_setenv.c | 12 ++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/TOOLS.md b/docs/TOOLS.md index 7dd1f83..75d6868 100644 --- a/docs/TOOLS.md +++ b/docs/TOOLS.md @@ -93,3 +93,12 @@ bg_setenv -x key=value ``` This will set the variable named `key` to `value` in the current environment. + +If The user wants to delete such a variable, the value after the `=` must be omitted, e.g. + +``` +bg_setenv -x key= +``` +will delete the variable with key `key`. + +*NOTE*: Currently, the tool does not support global user variables. Global user variables are modified in all environments simultaneously. As a workaround, the tool can be called with the `-p` option to manipulate every environment separately. diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c index e9156cd..3ed5a7f 100644 --- a/tools/bg_setenv.c +++ b/tools/bg_setenv.c @@ -65,8 +65,6 @@ struct env_action { STAILQ_HEAD(stailhead, env_action) head = STAILQ_HEAD_INITIALIZER(head); -static bool inhibit_global_store = false; - static void journal_free_action(struct env_action *action) { if (!action) { @@ -116,11 +114,10 @@ static void journal_process_action(BGENV *env, struct env_action *action) ebgenv_t e; char *tmp; - if (inhibit_global_store) { - /* If the environment is written to a file, we don't want a - * global variable storage, but only into the output file */ - action->type &= ~USERVAR_TYPE_GLOBAL; - } + /* Currently, the tools cannot handle global user variables correctly, + * users are asked to perform manual variable changes per + * configuration only. */ + action->type &= ~USERVAR_TYPE_GLOBAL; switch (action->task) { case ENV_TASK_SET: @@ -319,7 +316,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) break; case 'f': arguments->output_to_file = true; - inhibit_global_store = true; res = asprintf(&envfilepath, "%s/%s", arg, FAT_ENV_FILENAME); if (res == -1) { return ENOMEM; -- 2.15.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to efibootguard-dev+unsubscr...@googlegroups.com. To post to this group, send email to efibootguard-dev@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20171115155530.10893-1-andreas.reichel.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.