Move internal/efi.HostEnvironment into a separate sub-package
- Dominant language
- Go
- Stars
- 23
- Forks
- 29
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 2
Description
The `efi` sub-package has a public `HostEnvironment` interface for overriding
EFI variables and the TCG log, which is useful both for unit testing and producing
profiles without executing code within the host environment.
To support some cases in `efi/preinstall`, this interface was moved to `internal/efi`
with the originally exported interface now a type alias into an interface from
the internal package. The `internal/efi` package has a more extensive interface
that isn't exposed publicly (and with no intention to for now), but is used
for mocking host system properties during unit testing. However, most of this
extra functionality has nothing to do with EFI, and so `internal/efi` seems like
a weird place for this larger interface. This interface makes it possible to mock
the following things:
- The default TPMDevice.
- Whether the current environment is virtualized.
- Devices and their attributes in sysfs.
- CPU vendor (on amd64 builds)
- cpuid features (on amd64 builds)
- MSR values (on amd64).
None of these are related to EFI, which is why I think this interface and its
default implementation should move to a new package (maybe something
like `internal/system`?)
Contributor guide
Assessment
This issue has not been assessed yet.