fix(fsp): fix conflicting x modifiers in abstractions

This commit is contained in:
Alexandre Pujol 2024-03-10 18:57:05 +00:00
parent e3545cc3bb
commit df21886965
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
3 changed files with 20 additions and 5 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/arduino/go-paths-helper"
"github.com/roddhjav/apparmor.d/pkg/logging"
"github.com/roddhjav/apparmor.d/pkg/util"
)
// Prepare the build directory with the following tasks
@ -223,6 +224,19 @@ func SetFullSystemPolicy() ([]string, error) {
return res, err
}
// Fix conflicting x modifiers in abstractions - FIXME: Temporary solution
path = RootApparmord.Join("abstractions/gstreamer")
content, err = path.ReadFile()
if err != nil {
return res, err
}
out = string(content)
regFixConflictX := util.ToRegexRepl([]string{`.*gst-plugin-scanner.*`, ``})
out = regFixConflictX.Replace(out)
if err := path.WriteFile([]byte(out)); err != nil {
return res, err
}
// Set systemd unit drop-in files
return res, copyTo(paths.New("systemd/full/"), Root.Join("systemd"))
}

View file

@ -47,7 +47,7 @@ func RemoveDuplicate[T comparable](inlist []T) []T {
}
// ToRegexRepl convert slice of regex into a slice of RegexRepl
func ToRegexRepl(in []string) []RegexRepl {
func ToRegexRepl(in []string) RegexReplList {
out := make([]RegexRepl, 0)
idx := 0
for idx < len(in)-1 {