build: better way to handle debian hide file.

only needed as whonix needs special addition.
This commit is contained in:
Alexandre Pujol 2024-06-04 19:55:53 +01:00
parent 13d3b23a04
commit 41c0e57eca
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 28 additions and 4 deletions

View file

@ -5,11 +5,15 @@
package cfg
import (
"fmt"
"os"
"strings"
"github.com/roddhjav/apparmor.d/pkg/paths"
"github.com/roddhjav/apparmor.d/pkg/util"
)
// Default content of debian/apparmor.d.hide. Whonix has special addition.
var Hide = `# This file is generated by "make", all edit will be lost.
/etc/apparmor.d/usr.bin.firefox
@ -81,4 +85,16 @@ func (o Overwriter) Apply() error {
return nil
}
type DebianHider struct {
path *paths.Path
}
// Initialize the file with content from Hide
func (d DebianHider) Init() error {
return d.path.WriteFile([]byte(Hide))
}
// Initialize the file with content from Hide
func (d DebianHider) Clean() error {
return d.path.WriteFile([]byte("# This file is generated by \"make\", all edit will be lost.\n"))
}