build: add a --abi4 build flags.

convert the profiles to Apparmor abi/4.0
This commit is contained in:
Alexandre Pujol 2023-12-15 23:34:32 +00:00
parent 64a5dea47e
commit 8f1052546e
Failed to generate hash of commit

View file

@ -22,6 +22,7 @@ Options:
-f, --full Set AppArmor for full system policy. -f, --full Set AppArmor for full system policy.
-c, --complain Set complain flag on all profiles. -c, --complain Set complain flag on all profiles.
-e, --enforce Set enforce flag on all profiles. -e, --enforce Set enforce flag on all profiles.
--abi4 Convert the profiles to Apparmor abi/4.0.
` `
var ( var (
@ -29,6 +30,7 @@ var (
full bool full bool
complain bool complain bool
enforce bool enforce bool
abi4 bool
) )
func init() { func init() {
@ -40,6 +42,7 @@ func init() {
flag.BoolVar(&complain, "complain", false, "Set complain flag on all profiles.") flag.BoolVar(&complain, "complain", false, "Set complain flag on all profiles.")
flag.BoolVar(&enforce, "e", false, "Set enforce flag on all profiles.") flag.BoolVar(&enforce, "e", false, "Set enforce flag on all profiles.")
flag.BoolVar(&enforce, "enforce", false, "Set enforce flag on all profiles.") flag.BoolVar(&enforce, "enforce", false, "Set enforce flag on all profiles.")
flag.BoolVar(&abi4, "abi4", false, "Convert the profiles to Apparmor abi/4.0.")
} }
func aaPrebuild() error { func aaPrebuild() error {
@ -56,6 +59,9 @@ func aaPrebuild() error {
} else if enforce { } else if enforce {
prebuild.Builds = append(prebuild.Builds, prebuild.BuildEnforce) prebuild.Builds = append(prebuild.Builds, prebuild.BuildEnforce)
} }
if abi4 {
prebuild.Builds = append(prebuild.Builds, prebuild.BuildABI3)
}
if err := prebuild.Prepare(); err != nil { if err := prebuild.Prepare(); err != nil {
return err return err