使用fpm 軟件包打包

安裝

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

簡單使用

一個 redis的簡單demohtml

% 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

系統服務

製做一個通用平臺的系統服務redis

% 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.htmlcode

相關文章
相關標籤/搜索