1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-04-19 20:43:52 +02:00

fix: lintian issues (#445)

* fix: lintian issues

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: merge

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* docs: mention lintian

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: overrides

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2022-02-03 09:20:21 -03:00 committed by GitHub
parent 3ea7b84aa0
commit 1f50ccc830
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 12 deletions

View File

@ -126,23 +126,44 @@ scoop:
nfpms:
- file_name_template: '{{ .ProjectName }}_{{ .Arch }}'
homepage: https://nfpm.goreleaser.com
description: nFPM is a simple, 0-dependencies, deb, rpm and apk packager.
maintainer: Carlos Alexandro Becker <root@carlosbecker.com>
description: |-
A simple, 0-dependencies, deb, rpm and apk packager.
nFPM (not FPM) is configurable via YAML and does not need any packaging software installed.
maintainer: Carlos Alexandro Becker <carlos@becker.software>
license: MIT
vendor: GoReleaser
formats:
- apk
- deb
- rpm
bindir: /usr/bin
section: utils
contents:
- src: ./completions/nfpm.bash
dst: /etc/bash_completion.d/nfpm
dst: /usr/share/bash-completion/completions
file_info:
mode: 0644
- src: ./completions/nfpm.fish
dst: /usr/share/fish/completions/nfpm.fish
file_info:
mode: 0644
- src: ./completions/nfpm.zsh
dst: /usr/local/share/zsh/site-functions/_nfpm
dst: /usr/share/zsh/vendor-completions/_nfpm
file_info:
mode: 0644
- src: ./manpages/nfpm.1.gz
dst: /usr/share/man/man1/nfpm.1.gz
file_info:
mode: 0644
- src: ./LICENSE.md
dst: /usr/share/doc/nfpm/copyright
file_info:
mode: 0644
- src: .lintian-overrides
dst: ./usr/share/lintian/overrides/nfpm
packager: deb
file_info:
mode: 0644
aurs:
- homepage: https://nfpm.goreleaser.com

2
.lintian-overrides Normal file
View File

@ -0,0 +1,2 @@
nfpm: statically-linked-binary
nfpm: changelog-file-missing-in-native-package

View File

@ -2,4 +2,4 @@
set -e
rm -rf manpages
mkdir manpages
go run ./cmd/nfpm/ man | gzip -c >manpages/nfpm.1.gz
go run ./cmd/nfpm/ man | gzip -c -9 >manpages/nfpm.1.gz

View File

@ -1,8 +1,8 @@
# Tips, Hints, and useful information
## General maintainability of your packages
* Try hard to make all files work on all platforms you support.
* Maintaining separate scripts, config, service files, etc for each platform quickly becomes difficult
* Try hard to make all files work on all platforms you support.
* Maintaining separate scripts, config, service files, etc for each platform quickly becomes difficult
* Put as much conditional logic in the pre/post install scripts as possible instead of trying to build it into the nfpm.yaml
* *if* you need to know the packaging system I have found it useful to add a `/etc/path-to-cfg/package.env` that contains `_INSTALLED_FROM=apk|deb|rpm` which can be sourced into the pre/post install/remove scripts
* *if/when* you need to ask questions during the installation process, create an `install.sh` || `setup.sh` script that asks those questions and stores the answers as env vars in `/etc/path-to-cfg/package.env` for use by the pre/post install/remove scripts
@ -43,7 +43,7 @@ cleanInstall() {
if command -V chkconfig >/dev/null 2>&1; then
chkconfig --add <SERVICE NAME>
fi
service <SERVICE NAME> restart ||:
else
# rhel/centos7 cannot use ExecStartPre=+ to specify the pre start should be run as root
@ -89,13 +89,13 @@ case "$action" in
upgrade
;;
*)
# $1 == version being installed
# $1 == version being installed
printf "\033[32m Alpine\033[0m"
cleanInstall
;;
esac
# Step 4, clean up unused files, yes you get a warning when you remove the package, but that is ok.
# Step 4, clean up unused files, yes you get a warning when you remove the package, but that is ok.
cleanup
```
### Example Multi platform (RPM & Deb) post-remove script
@ -129,7 +129,7 @@ case "$action" in
upgrade
;;
*)
# $1 == version being installed
# $1 == version being installed
printf "\033[32m Alpine\033[0m"
cleanInstall
;;
@ -157,4 +157,22 @@ esac
* You should always use [Table 2. Automatic directory creation and environment variables](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#id-1.14.4.3.6.2)
* With the note that only `RuntimeDirectory` is used in systemd < 231
* `/bin/bash -c "$(which ...) ...` is a great way to make your single service file work on all platforms since rhel and debian based systems have standard executables in differing locations and complain about `executable path is not absolute`
* eg `/bin/bash -c '$(which mkdir) -p /var/log/your-service'`
* eg `/bin/bash -c '$(which mkdir) -p /var/log/your-service'`
### Debs and Lintian
Its recommended to run [lintian](https://lintian.debian.org) against your
deb packages to see if there are any problems.
You can also add a `lintian-overrides` file:
```yaml
contents:
- src: .lintian-overrides
dst: ./usr/share/lintian/overrides/nfpm
packager: deb
file_info:
mode: 0644
```
You can read more in [lintian's documentation](https://lintian.debian.org/manual/index.html).