1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-26 12:06:09 +02:00

feat: deb: create empty managed dirs

This commit is contained in:
Carlos Alexandro Becker 2018-05-16 20:59:24 -03:00 committed by Carlos Alexandro Becker
parent a2ecad5e17
commit 36ec9c04e2
2 changed files with 13 additions and 1 deletions

View File

@ -95,6 +95,14 @@ func createDataTarGz(info nfpm.Info) (dataTarGz, md5sums []byte, instSize int64,
defer compress.Close() // nolint: errcheck
var created = map[string]bool{}
for _, folder := range info.EmptyFolders {
// this .nope is actually not created, because createTree ignore the
// last part of the path, assuming it is a file.
// TODO: should probably refactor this
if err := createTree(out, filepath.Join(folder, ".nope"), created); err != nil {
return nil, nil, 0, err
}
}
var md5buf bytes.Buffer
for _, files := range []map[string]string{
@ -288,7 +296,7 @@ func pathsToCreate(dst string) []string {
paths = append(paths, base)
}
// we don't really need to create those things in order apparently, but,
// it looks really weird if we do.
// it looks really weird if we don't.
var result = []string{}
for i := len(paths) - 1; i >= 0; i-- {
result = append(result, paths[i])

View File

@ -52,6 +52,10 @@ func exampleInfo() nfpm.Info {
ConfigFiles: map[string]string{
"../testdata/whatever.conf": "/etc/fake/fake.conf",
},
EmptyFolders: []string{
"/var/log/whatever",
"/usr/share/whatever",
},
},
})
}