Replace dataroot module with BinDir and DataDir on instance, adapt modules
This commit is contained in:
@@ -2,10 +2,11 @@ package ui
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/safing/portmaster/base/api"
|
||||
"github.com/safing/portmaster/base/dataroot"
|
||||
"github.com/safing/portmaster/base/log"
|
||||
"github.com/safing/portmaster/service/mgr"
|
||||
"github.com/safing/portmaster/service/updates"
|
||||
@@ -28,7 +29,8 @@ func start() error {
|
||||
// may seem dangerous, but proper permission on the parent directory provide
|
||||
// (some) protection.
|
||||
// Processes must _never_ read from this directory.
|
||||
err := dataroot.Root().ChildDir("exec", 0o0777).Ensure()
|
||||
execDir := filepath.Join(module.instance.DataDir(), "exec")
|
||||
err := os.MkdirAll(execDir, 0o0777) //nolint:gosec // This is intentional.
|
||||
if err != nil {
|
||||
log.Warningf("ui: failed to create safe exec dir: %s", err)
|
||||
}
|
||||
@@ -81,6 +83,7 @@ func New(instance instance) (*UI, error) {
|
||||
}
|
||||
|
||||
type instance interface {
|
||||
DataDir() string
|
||||
API() *api.API
|
||||
BinaryUpdates() *updates.Updater
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user