nfpm 下载安装
wget https://github.com/goreleaser/nfpm/releases/download/v2.35.3/nfpm-2.35.3-1.x86_64.rpm
rpm -ivh nfpm-2.35.3-1.x86_64.rpm
nfpm 初始化
nfpm init
得到配置模板 nfpm.yaml
# nfpm example configuration file
#
# check https://nfpm.goreleaser.com/configuration for detailed usage
#
name: "foo"
arch: "amd64"
platform: "linux"
version: "1.0.0"
section: "default"
priority: "extra"
replaces:
- foobar
provides:
- bar
depends:
- foo
- bar
recommends:
- whatever
suggests:
- something-else
conflicts:
- not-foo
- not-bar
maintainer: "John Doe <john@example.com>"
description: |
FooBar is the great foo and bar software.
And this can be in multiple lines!
vendor: "FooBarCorp"
homepage: "http://example.com"
license: "MIT"
changelog: "changelog.yaml"
contents:
- src: ./foo
dst: /usr/bin/foo
- src: ./bar
dst: /usr/bin/bar
- src: ./foobar.conf
dst: /etc/foobar.conf
type: config
- src: /usr/bin/foo
dst: /sbin/foo
type: symlink
overrides:
rpm:
scripts:
preinstall: ./scripts/preinstall.sh
postremove: ./scripts/postremove.sh
deb:
scripts:
postinstall: ./scripts/postinstall.sh
preremove: ./scripts/preremove.sh
nfpm 打包
- deb包
nfpm pkg -t /tmp/foo.deb
- rpm包
nfpm pkg -t /tmp/foo.rpm