feat(aa): ensure the prebuild jobs are working.
This commit is contained in:
parent
fe4c86a245
commit
23eaa20fb7
5 changed files with 29 additions and 16 deletions
|
|
@ -58,7 +58,7 @@ func Run(file *paths.Path, profile string) (string, error) {
|
|||
for _, b := range Builds {
|
||||
profile, err = b.Apply(opt, profile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", fmt.Errorf("%s %s: %w", b.Name(), opt.File, err)
|
||||
}
|
||||
}
|
||||
return profile, nil
|
||||
|
|
|
|||
|
|
@ -30,10 +30,21 @@ func init() {
|
|||
}
|
||||
|
||||
func (b Userspace) Apply(opt *Option, profile string) (string, error) {
|
||||
p := aa.DefaultTunables()
|
||||
p.ParseVariables(profile)
|
||||
p.ResolveAttachments()
|
||||
att := p.NestAttachments()
|
||||
if ok, _ := opt.File.IsInsideDir(cfg.RootApparmord.Join("abstractions")); ok {
|
||||
return profile, nil
|
||||
}
|
||||
if ok, _ := opt.File.IsInsideDir(cfg.RootApparmord.Join("tunables")); ok {
|
||||
return profile, nil
|
||||
}
|
||||
|
||||
f := aa.DefaultTunables()
|
||||
if err := f.Parse(profile); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := f.Resolve(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
att := f.GetDefaultProfile().GetAttachments()
|
||||
matches := regAttachments.FindAllString(profile, -1)
|
||||
if len(matches) > 0 {
|
||||
strheader := strings.Replace(matches[0], "@{exec_path}", att, -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue