aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/system.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-23 21:46:21 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-23 21:46:21 +0900
commit6bc5be7e5a2334274adf2945ad6d29d063a7086b (patch)
treed99223898a282b7ea40c41330b5748a3b5f2b310 /internal/app/system.go
parente35c5fe3ed995d352c001bd7e35bd1214ca583da (diff)
internal: wrap calls to os standard library functions
This change helps tests stub out and simulate OS behaviour during the sealing process. This also removes dependency on XDG_RUNTIME_DIR as the internal.System implementation provided to App provides a compat directory inside the tmpdir-based share when XDG_RUNTIME_DIR is unavailable. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/system.go')
-rw-r--r--internal/app/system.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/app/system.go b/internal/app/system.go
index 2fc413e7..7ccc2eeb 100644
--- a/internal/app/system.go
+++ b/internal/app/system.go
@@ -5,6 +5,7 @@ import (
"git.ophivana.moe/security/fortify/dbus"
"git.ophivana.moe/security/fortify/helper/bwrap"
+ "git.ophivana.moe/security/fortify/internal"
"git.ophivana.moe/security/fortify/internal/system"
)
@@ -27,7 +28,7 @@ type appSealSys struct {
}
// shareAll calls all share methods in sequence
-func (seal *appSeal) shareAll(bus [2]*dbus.Config) error {
+func (seal *appSeal) shareAll(bus [2]*dbus.Config, os internal.System) error {
if seal.shared {
panic("seal shared twice")
}
@@ -35,11 +36,11 @@ func (seal *appSeal) shareAll(bus [2]*dbus.Config) error {
seal.shareSystem()
seal.shareRuntime()
- seal.sharePasswd()
- if err := seal.shareDisplay(); err != nil {
+ seal.sharePasswd(os)
+ if err := seal.shareDisplay(os); err != nil {
return err
}
- if err := seal.sharePulse(); err != nil {
+ if err := seal.sharePulse(os); err != nil {
return err
}