build: prepare new structure for directives.

This commit is contained in:
Alexandre Pujol 2024-03-21 20:36:41 +00:00
parent e1d1d0be3d
commit 2ca62215bc
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 159 additions and 3 deletions

View file

@ -12,11 +12,13 @@ import (
"github.com/roddhjav/apparmor.d/pkg/logging"
oss "github.com/roddhjav/apparmor.d/pkg/os"
"github.com/roddhjav/apparmor.d/pkg/prebuild"
"github.com/roddhjav/apparmor.d/pkg/prebuild/directive"
)
const usage = `prebuild [-h] [--full] [--complain | --enforce]
const usage = `prebuild [-h] [--full] [--complain | --enforce] [profiles...]
Prebuild apparmor.d profiles for a given distribution.
Prebuild apparmor.d profiles for a given distribution and apply
internal built-in directives.
Options:
-h, --help Show this help message and exit.
@ -24,6 +26,8 @@ Options:
-c, --complain Set complain flag on all profiles.
-e, --enforce Set enforce flag on all profiles.
--abi4 Convert the profiles to Apparmor abi/4.0.
Directives:
`
var (
@ -73,7 +77,13 @@ func aaPrebuild() error {
}
func main() {
flag.Usage = func() { fmt.Print(usage) }
flag.Usage = func() {
res := usage
for _, d := range directive.Directives {
res += ` ` + d.Usage() + "\n"
}
fmt.Print(res)
}
flag.Parse()
if help {
flag.Usage()