mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-15 07:54:17 +01:00
build: better way to copy special dist resources.
This commit is contained in:
parent
fdc5839dd9
commit
0b7f355269
@ -122,25 +122,20 @@ func Configure() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := paths.New("dists/ubuntu/abstractions/trash").CopyTo(RootApparmord.Join("abstractions", "trash")); err != nil {
|
// Copy Ubuntu specific profiles
|
||||||
|
if err := copyTo(DistDir.Join("ubuntu"), RootApparmord); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if Distribution == "ubuntu" {
|
if Distribution == "ubuntu" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, dirname := range []string{"abstractions", "tunables"} {
|
|
||||||
files, err := filepath.Glob("dists/debian/" + dirname + "/*")
|
// Copy debian specific profiles
|
||||||
if err != nil {
|
if err := copyTo(DistDir.Join("debian"), RootApparmord); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, file := range files {
|
|
||||||
path := paths.New(file)
|
// Remove ABI on abstractions files
|
||||||
if err := path.CopyTo(RootApparmord.Join(dirname, path.Base())); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
files, _ := RootApparmord.Join("abstractions").ReadDir(paths.FilterOutDirectories())
|
files, _ := RootApparmord.Join("abstractions").ReadDir(paths.FilterOutDirectories())
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if !file.Exist() {
|
if !file.Exist() {
|
||||||
@ -170,6 +165,22 @@ func setLibexec(libexec string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func copyTo(src *paths.Path, dst *paths.Path) error {
|
||||||
|
files, err := src.ReadDirRecursiveFiltered(nil, paths.FilterOutDirectories())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
destination, err := file.RelFrom(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
destination = dst.JoinPath(destination)
|
||||||
|
if err := file.CopyTo(destination); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set flags on some profiles according to manifest defined in `dists/flags/`
|
// Set flags on some profiles according to manifest defined in `dists/flags/`
|
||||||
|
Loading…
Reference in New Issue
Block a user