Signed-off-by: Tobias Schmidl <[email protected]>
---
 tools/bg_setenv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index d685412..4d4916a 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -21,6 +21,7 @@
 #include "bg_envtools.h"
 #include "bg_setenv.h"
 #include "bg_printenv.h"
+#include "env_user_config_file.h"
 
 static char tool_doc[] =
        "bg_setenv - Environment tool for the EFI Boot Guard";
@@ -351,6 +352,15 @@ static int dumpenv_to_file(char *envfilepath, bool 
verbosity, bool preserve_env)
        if (verbosity) {
                dump_env(env.data, &ALL_FIELDS, false);
        }
+
+       /* compare the filename. if we operate on bgenv.dat, use the old way,
+        * otherwise try the INI file approach. */
+       const char *file_name = strrchr(envfilepath, '/');
+       file_name = (file_name != NULL) ? file_name + 1 : envfilepath;
+
+       if (strcasecmp(file_name, FAT_ENV_FILENAME) != 0)
+               return env_user_config_file_write(envfilepath, &data, 
verbosity);
+
        FILE *of = fopen(envfilepath, "wb");
        if (of) {
                if (fwrite(&data, sizeof(BG_ENVDATA), 1, of) != 1) {
-- 
2.36.1

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20220809135300.1470407-7-tobiasschmidl%40siemens.com.

Reply via email to