build: update directives with the new interface.
This commit is contained in:
parent
38e9e5f08e
commit
08d4110c2a
9 changed files with 63 additions and 89 deletions
|
|
@ -8,20 +8,22 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/roddhjav/apparmor.d/pkg/aa"
|
||||
"github.com/roddhjav/apparmor.d/pkg/prebuild/cfg"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
type Exec struct {
|
||||
DirectiveBase
|
||||
cfg.Base
|
||||
}
|
||||
|
||||
func init() {
|
||||
Directives["exec"] = &Exec{
|
||||
DirectiveBase: DirectiveBase{
|
||||
message: "Exec directive applied",
|
||||
usage: `#aa:exec [P|U|p|u|PU|pu|] profiles_name...`,
|
||||
RegisterDirective(&Exec{
|
||||
Base: cfg.Base{
|
||||
Keyword: "exec",
|
||||
Msg: "Exec directive applied",
|
||||
Help: `#aa:exec [P|U|p|u|PU|pu|] profiles...`,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (d Exec) Apply(opt *Option, profile string) string {
|
||||
|
|
@ -35,7 +37,7 @@ func (d Exec) Apply(opt *Option, profile string) string {
|
|||
|
||||
p := &aa.AppArmorProfile{}
|
||||
for name := range opt.ArgMap {
|
||||
content, err := rootApparmord.Join(name).ReadFile()
|
||||
content, err := cfg.RootApparmord.Join(name).ReadFile()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue