Fix new profiles with custom config and implement review suggestions
This commit is contained in:
@@ -3,6 +3,7 @@ package process
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portbase/modules"
|
||||
"github.com/safing/portmaster/updates"
|
||||
)
|
||||
@@ -13,7 +14,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
module = modules.Register("processes", prep, start, nil, "profiles")
|
||||
module = modules.Register("processes", prep, start, nil, "profiles", "updates")
|
||||
}
|
||||
|
||||
func prep() error {
|
||||
@@ -21,10 +22,11 @@ func prep() error {
|
||||
}
|
||||
|
||||
func start() error {
|
||||
updatesPath = updates.RootPath() + string(os.PathSeparator)
|
||||
updatesPath = updates.RootPath()
|
||||
if updatesPath != "" {
|
||||
updatesPath += string(os.PathSeparator)
|
||||
}
|
||||
log.Warningf("process: using updates path %s", updatesPath)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ func (p *Process) GetProfile(ctx context.Context) (changed bool, err error) {
|
||||
profileID = profile.PortmasterAppProfileID
|
||||
case strings.Contains(p.Path, "portmaster-notifier"):
|
||||
profileID = profile.PortmasterNotifierProfileID
|
||||
default:
|
||||
// Unexpected binary from within the Portmaster updates directpry.
|
||||
log.Warningf("process: unexpected binary in the updates directory: %s", p.Path)
|
||||
// TODO: Assign a fully restricted profile in the future when we are
|
||||
// sure that we won't kill any of our own things.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +79,7 @@ func (p *Process) UpdateProfileMetadata() {
|
||||
}
|
||||
|
||||
// Update metadata of profile.
|
||||
metadataUpdated := localProfile.UpdateMetadata(p.Name, p.Path)
|
||||
metadataUpdated := localProfile.UpdateMetadata(p.Path)
|
||||
|
||||
// Mark profile as used.
|
||||
profileChanged := localProfile.MarkUsed()
|
||||
|
||||
Reference in New Issue
Block a user