build: reorganise build: abi4, fallback, prebuild cli
- ABI4 by default, fallback to abi 3. - aa-prebuild cli that can be used by other project shipping profiles. - --file option to cli to only build one dev profile. - add abi version filter to only & exclude directives.
This commit is contained in:
parent
d6b7bef89e
commit
59ac54e2fc
39 changed files with 473 additions and 440 deletions
62
pkg/prebuild/files.go
Normal file
62
pkg/prebuild/files.go
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// apparmor.d - Full set of apparmor profiles
|
||||
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
package prebuild
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/roddhjav/apparmor.d/pkg/paths"
|
||||
"github.com/roddhjav/apparmor.d/pkg/util"
|
||||
)
|
||||
|
||||
// Default content of debian/apparmor.d.hide. Whonix has special addition.
|
||||
var Hide = `# This file is generated by "make", all edit will be lost.
|
||||
|
||||
/etc/apparmor.d/usr.bin.firefox
|
||||
/etc/apparmor.d/usr.sbin.cups-browsed
|
||||
/etc/apparmor.d/usr.sbin.cupsd
|
||||
/etc/apparmor.d/usr.sbin.rsyslogd
|
||||
`
|
||||
|
||||
type Flagger struct{}
|
||||
|
||||
func (f Flagger) Read(name string) map[string][]string {
|
||||
res := map[string][]string{}
|
||||
path := FlagDir.Join(name + ".flags")
|
||||
if !path.Exist() {
|
||||
return res
|
||||
}
|
||||
|
||||
lines := util.MustReadFileAsLines(path)
|
||||
for _, line := range lines {
|
||||
manifest := strings.Split(line, " ")
|
||||
profile := manifest[0]
|
||||
flags := []string{}
|
||||
if len(manifest) > 1 {
|
||||
flags = strings.Split(manifest[1], ",")
|
||||
}
|
||||
res[profile] = flags
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
type Ignorer struct{}
|
||||
|
||||
func (i Ignorer) Read(name string) []string {
|
||||
path := IgnoreDir.Join(name + ".ignore")
|
||||
if !path.Exist() {
|
||||
return []string{}
|
||||
}
|
||||
return util.MustReadFileAsLines(path)
|
||||
}
|
||||
|
||||
type DebianHider struct {
|
||||
path *paths.Path
|
||||
}
|
||||
|
||||
// Initialize the file with content from Hide
|
||||
func (d DebianHider) Init() error {
|
||||
return d.path.WriteFile([]byte(Hide))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue