安装
yum install -y rpm-build yum install -y ruby-devel gcc gem source -a https://ruby.taobao.org/ gem source -r http://rubygems.org/ gem install fpm -Vfpm常用参数
-s: 指定源类型 -t: 指定目标类型,即想要制作为什么包 -n: 指定包的名字 -v: 指定包的版本号 -a: all - onarch, native x86_64 or i386 -C: 指定打包的相对路径,即build directory -d --depends: 指定依赖于哪些包 --post-install: 软件包安装完成之后所要运行的脚本,和'--after-install'意思一样 --pre-install: 软件包安装完成之前所要运行的脚本,和'--before-install'意思一样 --post-uninstall: 软件包卸载完成之后所要运行的脚本,和'--after-remove'意思一样 --pre-uninstall: 软件包卸载完成之前所要运行的脚本,和'--before-remove'意思一样示例
# tree monitor-agent-2.0/ monitor-agent-2.0/ ├── etc │ ├── nagios │ │ └── nrpe.cfg.rpmnew │ └── nrpe.d │ ├── app.cfg │ ├── base.cfg │ └── dell.cfg ├── monitor-agent-2.0-1.x86_64.rpm ├── post-install ├── post-uninstall ├── pre-install ├── pre-uninstall └── usr └── lib64 └── nagios └── plugins ├── check_broadcast_status ├── check_live_status ├── check_live_transfer └── check_systempre-install
#!/bin/bash mv /etc/nagios/nrpe.cfg /etc/nagios/nrpe.cfg.rpmsavepost-install
#!/bin/bash chmod 755 /usr/lib64/nagios/plugins/check_* cp /etc/nagios/nrpe.cfg.rpmnew /etc/nagios/nrpe.cfg version=$(rpm -q --queryformat '%{VERSION}' centos-release) if [ $version == '6' ]; then /etc/init.d/nrpe start && chkconfig nrpe on elif [ $version == '7' ]; then systemctl start nrpe.service && systemctl enable nrpe.service fipre-uninstall
#!/bin/bashpost-uninstall
#!/bin/bash version=$(rpm -q --queryformat '%{VERSION}' centos-release) if [ $version == '6' ]; then /etc/init.d/nrpe restart elif [ $version == '7' ]; then systemctl restart nrpe.service fi打包
fpm -s dir -t rpm -n 'monitor-agent' -v 2.0 --vendor 'tvm' -d 'nrpe >= 2.15' -d 'nagios-plugins >= 2.0.3' \ --pre-install pre-install --post-install post-install --pre-uninstall post-uninstall --post-uninstall post-uninstall \ etc usr posted on 2015-03-25 15:34 北京涛子 阅读( ...) 评论( ...) 编辑 收藏转载于:https://www.cnblogs.com/liujitao79/p/4365866.html
相关资源:各显卡算力对照表!