goreleaser / nfpm

nFPM is Not FPM - a simple deb, rpm, apk, ipk, and arch linux packager written in Go
https://nfpm.goreleaser.com/
MIT License
2.09k stars 154 forks source link

[apk] package file format error #805

Closed cnt0 closed 1 week ago

cnt0 commented 3 months ago

What happened?

OK, I build the apk package with the following config

# ...
contents:
- src: ./install
  dst: /usr
  type: tree

apk:
  signature:
    key_file: xxxx.rsa
    key_name: xxxx.rsa.pub

uploaded to local repository and trying to install it. I'm getting the following error:

$ doas apk add my_package
ERROR: my_package: package file format error

I managed to investigate this problem on the apk side and found that it complains about the missing mode data in the archive. So it can be worked around by modifying the nfpm.yaml like this:

# ...
contents:
- src: ./install
  dst: /usr
  type: tree
  file_info:
    mode: 0755
# ...

However, this file_info attribute is actually very dangerous with such config, cause it can overwrite your /usr/bin, /usr/lib, etc permissions with some incorrect value, resulting in unusable system. So I'd rather fix the appropriate parts of nfpm code.

How can we reproduce this?

prepare the apk package with config described above, add to the repository and try installing it with apk add command

nfpm version

the one from https://github.com/goreleaser/nfpm/pull/804 (so git main, essentially)

Search

Code of Conduct

Additional context

No response

caarlos0 commented 3 weeks ago

I think this will be fixed by #834