mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-31 07:17:22 +01:00
fix(build): ensure the displace file get cleaned when not needed.
This commit is contained in:
parent
1f3b812cfb
commit
45a6e0bf21
2 changed files with 10 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue