You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This will add all files in some/directory or in subdirectories at the
# same level under the directory /etc. This means the tree structure in
# some/directory will not be replicated.
- src: some/directory/
dst: /etc
The doc above claims all files in subdirectories will be added at the same level (flattened) with dest: /etc. This isn't correct; it doesn't flatten the result. It duplicates the directory structure like a tree would, but it does not take ownership of these directories like a tree would (at least with RPM). It should probably be documented as such, because that behavior is very useful when avoiding ownership of system directories like /usr/bin in rpms.
In order to get the effect described above where it flattens the directory, you need to add a trailing slash, /etc/:
- src: some/directory/ dst: /etc/
I'm not sure the flattening with /etc/ is useful (it apparently came about via #576) but the point is, the lack of a trailing slash with /etc is definitely useful.
In tree mode, the trailing slash seems to have no effect; the structure is always duplicated and you take ownership of all directories. So that documentation can be left alone.
Relatedly, it is not documented how to duplicate a structure (without ownership) into the root directory. For example, with the source below:
root/usr/bin/foo
root/usr/libexec/foo
If you do the following now:
- src: ./root
dst: /
you will get a conflict as / is considered a trailing slash and both foo are flattened into /foo. This used to work before #576. The solution is to use a blank destination:
- src: ./root
dst: "" # or leave this blank
which will create /usr/bin/foo and /usr/libexec/foo.
On the minus side, if you try dst: "" on an older version (before #576) -- say if your users are still on an older version of nfpm --- it packages instead
usr/bin/foo
usr/libexec/foo
without a leading slash, which creates a relative path RPM that is almost never what you want. So it may not be a good idea to officially document dst: "" after all as it could lead to bad results. In this case the following, more explicit destination would be safer:
- src: ./root/usr
dst: /usr
because it removes the ambiguity of /.
How can we reproduce this?
See above.
nfpm version
nfpm version nfpm version 2.30.0
commit: af65ba8a60cf41e2f5e197c85d086f6696556055
built at: 2023-06-05T17:45:31Z
built by: goreleaser
module version: v2.30.0, checksum: h1:lx6mVLZPBjRDUn18SLxwF+VTq4TkhYkB2WULhXrXthA=
Search
I did search for other open and closed issues before opening this.
Code of Conduct
I agree to follow this project's Code of Conduct
Additional context
No response
The text was updated successfully, but these errors were encountered:
What happened?
When using file (not tree) mode, the config documentation doesn't accurately describe what the lack of a trailing slash does.
nfpm/www/docs/configuration.md
Lines 157 to 161 in a72ecd2
The doc above claims all files in subdirectories will be added at the same level (flattened) with
dest: /etc
. This isn't correct; it doesn't flatten the result. It duplicates the directory structure like a tree would, but it does not take ownership of these directories like a tree would (at least with RPM). It should probably be documented as such, because that behavior is very useful when avoiding ownership of system directories like/usr/bin
in rpms.In order to get the effect described above where it flattens the directory, you need to add a trailing slash,
/etc/
:I'm not sure the flattening with
/etc/
is useful (it apparently came about via #576) but the point is, the lack of a trailing slash with/etc
is definitely useful.In tree mode, the trailing slash seems to have no effect; the structure is always duplicated and you take ownership of all directories. So that documentation can be left alone.
Relatedly, it is not documented how to duplicate a structure (without ownership) into the root directory. For example, with the source below:
If you do the following now:
you will get a conflict as
/
is considered a trailing slash and bothfoo
are flattened into/foo
. This used to work before #576. The solution is to use a blank destination:which will create
/usr/bin/foo
and/usr/libexec/foo
.On the minus side, if you try
dst: ""
on an older version (before #576) -- say if your users are still on an older version of nfpm --- it packages insteadwithout a leading slash, which creates a relative path RPM that is almost never what you want. So it may not be a good idea to officially document
dst: ""
after all as it could lead to bad results. In this case the following, more explicit destination would be safer:because it removes the ambiguity of
/
.How can we reproduce this?
See above.
nfpm version
Search
Code of Conduct
Additional context
No response
The text was updated successfully, but these errors were encountered: