1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-24 05:56:16 +02:00

feat: rpm: create empty managed dirs

This commit is contained in:
Carlos Alexandro Becker 2018-05-16 20:58:56 -03:00 committed by Carlos Alexandro Becker
parent 03334d1cf3
commit a2ecad5e17
5 changed files with 44 additions and 4 deletions

View File

@ -358,7 +358,10 @@ Suggests: {{ . }}
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -vp %{buildroot}
{{ range $index, $element := .Info.EmptyFolders }}
mkdir -vp %{buildroot}{{ . }}
{{ end }}
# in builddir
cp -a * %{buildroot}
@ -378,6 +381,9 @@ rm -rf %{buildroot}
{{ range $index, $element := .Info.ConfigFiles }}
%config(noreplace) {{ . }}
{{ end }}
{{ range $index, $element := .Info.EmptyFolders }}
{{ . }}
{{ end }}
%pre
{{ if .Scripts.Pre }}{{ .Scripts.Pre }}{{ else }}# noop{{ end }}

View File

@ -51,6 +51,10 @@ func exampleInfo() nfpm.Info {
ConfigFiles: map[string]string{
"../testdata/whatever.conf": "/etc/fake/fake.conf",
},
EmptyFolders: []string{
"/var/log/whatever",
"/usr/share/whatever",
},
Scripts: nfpm.Scripts{
PreInstall: "../testdata/scripts/preinstall.sh",
PostInstall: "../testdata/scripts/postinstall.sh",

View File

@ -44,7 +44,12 @@ Foo does things
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -vp %{buildroot}
mkdir -vp %{buildroot}/var/log/whatever
mkdir -vp %{buildroot}/usr/share/whatever
# in builddir
cp -a * %{buildroot}
@ -65,6 +70,11 @@ rm -rf %{buildroot}
%config(noreplace) /etc/fake/fake.conf
/var/log/whatever
/usr/share/whatever
%pre
#!/bin/bash

View File

@ -52,7 +52,12 @@ Foo does things
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -vp %{buildroot}
mkdir -vp %{buildroot}/var/log/whatever
mkdir -vp %{buildroot}/usr/share/whatever
# in builddir
cp -a * %{buildroot}
@ -73,6 +78,11 @@ rm -rf %{buildroot}
%config(noreplace) /etc/fake/fake.conf
/var/log/whatever
/usr/share/whatever
%pre
#!/bin/bash

View File

@ -52,7 +52,12 @@ Foo does things
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -vp %{buildroot}
mkdir -vp %{buildroot}/var/log/whatever
mkdir -vp %{buildroot}/usr/share/whatever
# in builddir
cp -a * %{buildroot}
@ -73,6 +78,11 @@ rm -rf %{buildroot}
%config(noreplace) /etc/fake/fake.conf
/var/log/whatever
/usr/share/whatever
%pre
#!/bin/bash