build: add support for apparmor 4.1

Enabled when prebuild is run with the --version 4.1 argument
This commit is contained in:
Alexandre Pujol 2025-03-14 22:07:59 +01:00
parent ebc8b29b1d
commit e4a7e16ec0
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
5 changed files with 37 additions and 3 deletions

View file

@ -55,5 +55,21 @@ func (p Configure) Apply() ([]string, error) {
return []string{}, fmt.Errorf("%s is not a supported distribution", prebuild.Distribution)
}
if prebuild.Version == "4.1" {
// Remove files upstreamed in 4.1
remove := []string{
"abstractions/devices-usb-read",
"abstractions/devices-usb",
"abstractions/nameservice-strict",
"tunables/multiarch.d/base",
"wg", // Upstream version is identical
}
for _, name := range remove {
if err := prebuild.RootApparmord.Join(name).RemoveAll(); err != nil {
return res, err
}
}
}
return res, nil
}