From 2f6fba281dbde86a1c46ff3356fa8b63f2357a71 Mon Sep 17 00:00:00 2001 From: x5a17ed <0x5a17ed@tuta.io> Date: Sat, 7 May 2022 19:27:23 +0200 Subject: [PATCH] feature: NewDefaultContext: mimic efivar EFIVARFS_PATH --- efi/efivario/context_linux.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/efi/efivario/context_linux.go b/efi/efivario/context_linux.go index 15e9584..fc5c4af 100644 --- a/efi/efivario/context_linux.go +++ b/efi/efivario/context_linux.go @@ -17,6 +17,8 @@ package efivario import ( + "os" + "github.com/spf13/afero" ) @@ -29,5 +31,9 @@ func NewContext(path string) Context { } func NewDefaultContext() Context { - return NewContext(DefaultEfiPath) + dir := os.Getenv("EFIVARFS_PATH") + if dir == "" { + dir = DefaultEfiPath + } + return NewContext(dir) }