diff --git a/pkg/prebuild/prepare.go b/pkg/prebuild/prepare.go index 94e0f02c..1e211a96 100644 --- a/pkg/prebuild/prepare.go +++ b/pkg/prebuild/prepare.go @@ -131,10 +131,8 @@ func Configure() ([]string, error) { case "arch", "opensuse": case "ubuntu": + debianDisplaceClean() if needDisplace { - if _, err := paths.New("debian/apparmor.d.displace").Create(); err != nil { - return res, err - } filesToDisplace := overwriteProfile(DistDir.Join("displace")) if err := displaceFiles(filesToDisplace); err != nil { return res, err @@ -145,6 +143,8 @@ func Configure() ([]string, error) { } } case "debian", "whonix": + debianDisplaceClean() + // Copy Debian specific abstractions if err := copyTo(DistDir.Join("ubuntu"), RootApparmord); err != nil { return res, err diff --git a/pkg/prebuild/tools.go b/pkg/prebuild/tools.go index 7110f702..a7f752e3 100644 --- a/pkg/prebuild/tools.go +++ b/pkg/prebuild/tools.go @@ -110,6 +110,13 @@ func displaceFiles(files []string) error { return nil } +// Clean the debian/displace file +func debianDisplaceClean() { + if _, err := paths.New("debian/apparmor.d.displace").Create(); err != nil { + panic(err) + } +} + func overwriteProfile(path *paths.Path) []string { res := []string{} lines, err := path.ReadFileAsLines()