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
4 changed files with 53 additions and 12 deletions
+25 -4
View File
@@ -126,23 +126,44 @@ scoop:
nfpms: nfpms:
- file_name_template: '{{ .ProjectName }}_{{ .Arch }}' - file_name_template: '{{ .ProjectName }}_{{ .Arch }}'
homepage: https://nfpm.goreleaser.com homepage: https://nfpm.goreleaser.com
description: nFPM is a simple, 0-dependencies, deb, rpm and apk packager. description: |-
maintainer: Carlos Alexandro Becker <root@carlosbecker.com> 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 license: MIT
vendor: GoReleaser vendor: GoReleaser
formats: formats:
- apk - apk
- deb - deb
- rpm - rpm
bindir: /usr/bin
section: utils
contents: contents:
- src: ./completions/nfpm.bash - src: ./completions/nfpm.bash
dst: /etc/bash_completion.d/nfpm dst: /usr/share/bash-completion/completions
file_info:
mode: 0644
- src: ./completions/nfpm.fish - src: ./completions/nfpm.fish
dst: /usr/share/fish/completions/nfpm.fish dst: /usr/share/fish/completions/nfpm.fish
file_info:
mode: 0644
- src: ./completions/nfpm.zsh - 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 - src: ./manpages/nfpm.1.gz
dst: /usr/share/man/man1/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: aurs:
- homepage: https://nfpm.goreleaser.com - homepage: https://nfpm.goreleaser.com
+2
View File
@@ -0,0 +1,2 @@
nfpm: statically-linked-binary
nfpm: changelog-file-missing-in-native-package
+1 -1
View File
@@ -2,4 +2,4 @@
set -e set -e
rm -rf manpages rm -rf manpages
mkdir 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
+25 -7
View File
@@ -1,8 +1,8 @@
# Tips, Hints, and useful information # Tips, Hints, and useful information
## General maintainability of your packages ## General maintainability of your packages
* Try hard to make all files work on all platforms you support. * 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 * 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 * 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* 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 * *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 if command -V chkconfig >/dev/null 2>&1; then
chkconfig --add <SERVICE NAME> chkconfig --add <SERVICE NAME>
fi fi
service <SERVICE NAME> restart ||: service <SERVICE NAME> restart ||:
else else
# rhel/centos7 cannot use ExecStartPre=+ to specify the pre start should be run as root # rhel/centos7 cannot use ExecStartPre=+ to specify the pre start should be run as root
@@ -89,13 +89,13 @@ case "$action" in
upgrade upgrade
;; ;;
*) *)
# $1 == version being installed # $1 == version being installed
printf "\033[32m Alpine\033[0m" printf "\033[32m Alpine\033[0m"
cleanInstall cleanInstall
;; ;;
esac 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 cleanup
``` ```
### Example Multi platform (RPM & Deb) post-remove script ### Example Multi platform (RPM & Deb) post-remove script
@@ -129,7 +129,7 @@ case "$action" in
upgrade upgrade
;; ;;
*) *)
# $1 == version being installed # $1 == version being installed
printf "\033[32m Alpine\033[0m" printf "\033[32m Alpine\033[0m"
cleanInstall 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) * 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 * 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` * `/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).