使用fpm 软件包打包

安装

sudo gem install --no-ri --no-rdoc fpm

简单使用

一个 redis的简单demo

% ls src/redis-server redis.conf
src/redis-server
redis.conf

# install src/redis-server into /usr/bin/
# install redis.conf into /etc/redis/
% fpm -s dir -t deb -n redis --config-files /etc/redis/redis.conf -v 2.6.10 \
  src/redis-server=/usr/bin/ \
  redis.conf=/etc/redis/
Created deb package {:path=>"redis_2.6.10_amd64.deb"}

% dpkg -c redis_2.6.10_amd64.deb
drwx------ jls/jls 0 2013-07-11 23:49 ./
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./etc/
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./etc/redis/
-rw-rw-r-- jls/jls 24475 2013-02-11 04:24 ./etc/redis/redis.conf
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./usr/
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./usr/bin/
-rwxrwxr-x jls/jls 3566152 2013-02-14 11:19 ./usr/bin/redis-server

# Did the conffiles setting work? Yep!
% dpkg-deb -e redis_2.6.10_amd64.deb .
% cat conffiles
/etc/redis/redis.conf

系统服务

制作一个通用平台的系统服务

% 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

说明

使用fpm 工具,对于我们软件的分发如虎添翼,很方便,很强大

参考资料

https://fpm.readthedocs.io/en/latest/source/pleaserun.html
https://fpm.readthedocs.io/en/latest/source/dir.html

posted on 2019-04-08 22:33  荣锋亮  阅读(498)  评论(0编辑  收藏  举报

导航