Integrate config-protect from package spec

This commit is contained in:
Daniele Rondina
2020-06-06 13:12:54 +02:00
parent aaa73dc2ac
commit 3a365c709b
5 changed files with 154 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import (
. "github.com/mudler/luet/pkg/config"
"github.com/mudler/luet/pkg/helpers"
. "github.com/mudler/luet/pkg/logger"
pkg "github.com/mudler/luet/pkg/package"
"github.com/mudler/luet/pkg/solver"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
@@ -343,6 +344,16 @@ func (a *PackageArtifact) GetProtectFiles() []string {
}
}
if a.CompileSpec.GetPackage().HasAnnotation(string(pkg.ConfigProtectAnnnotation)) {
dir, ok := a.CompileSpec.GetPackage().GetAnnotations()[string(pkg.ConfigProtectAnnnotation)]
if ok {
if strings.HasPrefix("/"+file, filepath.Clean(dir)) {
ans = append(ans, file)
goto nextFile
}
}
}
nextFile:
}
}