From 1f50ccc8302150320552d7fe6dd9e2c15d604a1e Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 3 Feb 2022 09:20:21 -0300 Subject: [PATCH] fix: lintian issues (#445) * fix: lintian issues Signed-off-by: Carlos A Becker * fix: merge Signed-off-by: Carlos A Becker * docs: mention lintian Signed-off-by: Carlos A Becker * fix: overrides Signed-off-by: Carlos A Becker --- .goreleaser.yml | 29 +++++++++++++++++++++++++---- .lintian-overrides | 2 ++ scripts/manpages.sh | 2 +- www/docs/tips.md | 32 +++++++++++++++++++++++++------- 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 .lintian-overrides diff --git a/.goreleaser.yml b/.goreleaser.yml index 1bb2f90..6e4de08 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 + 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 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 diff --git a/.lintian-overrides b/.lintian-overrides new file mode 100644 index 0000000..c4f8321 --- /dev/null +++ b/.lintian-overrides @@ -0,0 +1,2 @@ +nfpm: statically-linked-binary +nfpm: changelog-file-missing-in-native-package diff --git a/scripts/manpages.sh b/scripts/manpages.sh index c5affd1..26d8f87 100755 --- a/scripts/manpages.sh +++ b/scripts/manpages.sh @@ -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 diff --git a/www/docs/tips.md b/www/docs/tips.md index 45b3306..0752785 100644 --- a/www/docs/tips.md +++ b/www/docs/tips.md @@ -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 fi - + service 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'` \ No newline at end of file + * 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).