[PATCH] Tools: Disable global variable settings in tools for now.

0 views
Skip to first unread message

Andreas J. Reichel

unread,
Nov 15, 2017, 10:22:36 AM11/15/17
to efibootg...@googlegroups.com, Andreas Reichel, jan.k...@siemens.com
From: Andreas Reichel <andreas.r...@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.r...@siemens.com>
---
tools/bg_setenv.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

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

Andreas J. Reichel

unread,
Nov 15, 2017, 10:57:09 AM11/15/17
to efibootg...@googlegroups.com, Andreas Reichel, jan.k...@siemens.com
From: Andreas Reichel <andreas.r...@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.r...@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.
Reply all
Reply to author
Forward
0 new messages