使用fpm 方便快速生成postgresql extension分发包
fpm 是一个不错,而且强大的rpm、deb,系统启动服务工具包,我们可以用来快速的生成专业的软件分发包
演示一个pg 扩展包分发包的生成(rpm 以及deb)
安装fpm
sudo gem install --no-ri --no-rdoc fpm
clone pg 扩展项目
代码已经写好了,使用plgo 参考https://www.cnblogs.com/rongfengliang/p/10672695.html
git clone https://github.com/rongfengliang/fpm-pg-extension-package-generate-demo
生成rpm 包
- 生成
fpm -s dir -t rpm -n myplgo-extension ./example--0.1.sql=/usr/pgsql-10/share/extension/ ./example.control=/usr/pgsql-10/share/extension/ ./example.so=/usr/pgsql-10/lib/
- 查看内容
rpm2cpio myplgo-extension-1.0-1.x86_64.rpm | cpio -t
效果
./usr/pgsql-10/lib/example.so
./usr/pgsql-10/share/extension/example--0.1.sql
./usr/pgsql-10/share/extension/example.control
生成deb 包
- 生成
fpm -s dir -t deb -n myplgo-extension ./example--0.1.sql=/usr/pgsql-10/share/extension/ ./example.control=/usr/pgsql-10/share/extension/ ./example.so=/usr/pgsql-10/lib/
- 查看内容
dpkg -c myplgo-extension_1.0_amd64.deb
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/pgsql-10/
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/pgsql-10/lib/
-rw-r--r-- 0/0 3316752 2019-04-09 11:39 ./usr/pgsql-10/lib/example.so
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/pgsql-10/share/
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/pgsql-10/share/extension/
-rw-r--r-- 0/0 1005 2019-04-09 11:39 ./usr/pgsql-10/share/extension/example--0.1.sql
-rw-r--r-- 0/0 92 2019-04-09 11:39 ./usr/pgsql-10/share/extension/example.control
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/share/
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/share/doc/
drwxr-xr-x 0/0 0 2019-04-09 13:08 ./usr/share/doc/myplgo-extension/
-rw-r--r-- 0/0 142 2019-04-09 13:08 ./usr/share/doc/myplgo-extension/changelog.gz
说明
演示的比较简单,主要是使用fpm 也很简单,我们不需要关注太多的包代码细节,直接使用就可以了,主要是进行配置而已
对于需要添加系统服务的也很简单,参考如下:
% fpm -s pleaserun -t rpm -n example /usr/bin/example
% rpm -qlp example-1.0-1.x86_64.rpm
/usr/share/pleaserun/example/generate-cleanup.sh
/usr/share/pleaserun/example/install-path.sh
/usr/share/pleaserun/example/install.sh
/usr/share/pleaserun/example/launchd/10.9/files/Library/LaunchDaemons/example.plist
/usr/share/pleaserun/example/launchd/10.9/install_actions.sh
/usr/share/pleaserun/example/systemd/default/files/etc/default/example
/usr/share/pleaserun/example/systemd/default/files/etc/systemd/system/example.service
/usr/share/pleaserun/example/systemd/default/install_actions.sh
/usr/share/pleaserun/example/sysv/lsb-3.1/files/etc/default/example
/usr/share/pleaserun/example/sysv/lsb-3.1/files/etc/init.d/example
/usr/share/pleaserun/example/upstart/0.6.5/files/etc/default/example
/usr/share/pleaserun/example/upstart/0.6.5/files/etc/init/example.conf
/usr/share/pleaserun/example/upstart/1.5/files/etc/default/example
/usr/share/pleaserun/example/upstart/1.5/files/etc/init/example.conf
参考资料
https://github.com/rongfengliang/fpm-pg-extension-package-generate-demo
https://www.cnblogs.com/rongfengliang/p/10674023.html
https://www.cnblogs.com/rongfengliang/p/10672695.html
https://github.com/rongfengliang/plgo-rpm
https://github.com/rongfengliang/plgo
https://fpm.readthedocs.io/en/latest/intro.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2014-04-09 web性能优化