使用nfpm打包deb&&rpm
nfpm是受fpm启发的一个deb以及rpm包制作工具,goreleaser中的rpm包制作就依赖此包(当然是同一个人开发的)
使用nfpm的好处是简单,跨平台(基于golang同时包也小),以下是一个简单的使用
安装nfpm
比较简单,从github下载即可,https://github.com/goreleaser/nfpm/releases
使用
- init
使用init 可以帮助我们生成一个配置模版,命令nfpm init
nfpm init 内容如下(主要是关于deb以及rpm依赖的资源以及配置还有安装中的一些脚本)
# nfpm example config file
name: "foo"
arch: "amd64"
platform: "linux"
version: "v${MY_APP_VERSION}"
section: "default"
priority: "extra"
replaces:
- foobar
provides:
- bar
depends:
- foo
- bar
# recommends on rpm packages requires rpmbuild >= 4.13
recommends:
- whatever
# suggests on rpm packages requires rpmbuild >= 4.13
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"
bindir: "/usr/local/bin"
files:
./foo: "/usr/local/bin/foo"
./bar: "/usr/local/bin/bar"
config_files:
./foobar.conf: "/etc/foobar.conf"
overrides:
rpm:
scripts:
preinstall: ./scripts/preinstall.sh
postremove: ./scripts/postremove.sh
deb:
scripts:
postinstall: ./scripts/postinstall.sh
preremove: ./scripts/preremove.sh
- 创建demo资源
因为是测试,我们需要参考上边的yaml,创建需要的文件,比如shell 脚本依赖的部署文件,内容可以为空
主要是测试
├── bar
├── foo
├── foobar.conf
├── nfpm.yaml
└── scripts
├── postinstall.sh
├── postremove.sh
├── preinstall.sh
└── preremove.sh
- 打包
nfpm pkg -t /tmp/foo.deb
nfpm pkg -t /tmp/foo.rpm
效果
说明
nfpm 是一个不错的deb以及rpm打包工具,相对比fpm 弱了点,但是安装以及使用简单,是一个不错的工具
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2019-04-05 algernon 基于golang 的独立的支持redis lua pg。。。 的web server
2018-04-05 elixir mix开发入门
2018-04-05 memsql 基本安装试用
2017-04-05 maven docker plugin 常见问题解决