• rpm打包工具


    http://fedoraproject.org/wiki/How_to_create_an_RPM_package

    # rpm --showrc|grep _topdir
    -14: _builddir	%{_topdir}/BUILD
    -14: _buildrootdir	%{_topdir}/BUILDROOT
    -14: _rpmdir	%{_topdir}/RPMS
    -14: _sourcedir	%{_topdir}/SOURCES
    -14: _specdir	%{_topdir}/SPECS
    -14: _srcrpmdir	%{_topdir}/SRPMS
    -14: _topdir	%{getenv:HOME}/rpmbuild
    
    # echo %_topdir $HOME/rpmbuild > ~/.rpmmacros
    
    # cat ~/.rpmmacros 
    %_topdir /root/rpmbuild
    
    # mkdir -p ~/rpmbuild/{BUILD,RPMS/x86_64,S{OURCE,PEC,RPM}S}
    
    # tree /root/rpmbuild/
    /root/rpmbuild/
    ├── BUILD
    │   └── monitor-agent-1.0
    ├── BUILDROOT
    ├── RPMS
    │   └── x86_64
    ├── SOURCES
    │   ├── monitor-agent-1.0
    │   └── monitor-agent-1.0.tar.gz
    ├── SPECS
    │   └── monitor-agent.spec
    └── SRPMS
    
    # monitor-agent.spec 
    Name:	    monitor-agent	
    Version:    1.0	
    Release:	1%{?dist}
    Summary:	monitor-agent
    
    Group:      Applications/System	
    License:	GPL
    Source0:    %{name}-%{version}.tar.gz
    BuildRoot:	%{_builddir}/%{name}-%{version}
    
    Requires:   nagios-plugins,nrpe,net-snmp-perl,perl-XML-LibXML,perl-JSON,perl-libwww-perl,perl-XML-XPath,perl-Net-Telnet,perl-Net-DNS,perl-DBI,perl-DBD-MySQL,perl-DBD-Pg,perl-Email-Send,
    
    %description
    
    %prep
    %setup -q
    
    %build
    
    %install
    rm -rf %{buildroot}
    mkdir -p %{buildroot}/usr/lib64/nagios/plugins
    mkdir -p %{buildroot}/etc/nagios
    mkdir -p %{buildroot}/etc/nrpe.d
    
    cp -rfp centreon-plugins %{buildroot}/usr/lib64/nagios/plugins
    install -m 0755 check_live_status.py %{buildroot}/usr/lib64/nagios/plugins
    install -m 0755 check_live_transfer.py %{buildroot}/usr/lib64/nagios/plugins
    install -m 0755 check_nfsmounts.pl %{buildroot}/usr/lib64/nagios/plugins
    
    install -m 0644 cfg/base.cfg %{buildroot}/etc/nrpe.d
    install -m 0644 cfg/app.cfg %{buildroot}/etc/nrpe.d
    install -m 0644 cfg/nrpe.cfg %{buildroot}/etc/nagios
    
    %clean
    rm -rf %{buildroot}
    
    %files
    %defattr(-,root,root)
    /usr/lib64/nagios/plugins/centreon-plugins
    /usr/lib64/nagios/plugins/check_live_status.py
    /usr/lib64/nagios/plugins/check_live_transfer.py
    /usr/lib64/nagios/plugins/check_nfsmounts.pl
    /etc/nagios/nrpe.cfg
    /etc/nrpe.d/base.cfg
    /etc/nrpe.d/app.cfg
    
    %pre
    [ -e '/etc/yum.repos.d/rpmforge.repo' ] && mv -f /etc/yum.repos.d/rpmforge.repo /etc/yum.repos.d/rpmforge.repo.rpmsave
    yum clean all
    
    %post
    
    %preun
    
    %postun
    rm -rf /usr/lib64/nagios/plugins/centreon-plugins
    rm -rf /usr/lib64/nagios/plugins/{check_live_status.py,check_live_transfer.py,check_nfsmounts.pl}
    rm -rf /etc/nrpe.d/{base.cfg,app.cfg}
    /etc/init.d/nrpe restart
    
    %changelog
    
    rpmbulid -bb monitor-agent.spec
    
  • 相关阅读:
    kafka学习3——单机伪集群(window版)
    (转)在阿里云 CentOS 服务器(ECS)上搭建 nginx + mysql + php-fpm 环境
    渗透测试工具sqlmap基础教程
    编译安装nginx后service nginx start 启动不了
    centos6.5上tomcat的安装
    centos6.5上安装淘宝tfs系统
    解决nagios登录不了的问题
    centos6.5上网络不通解决方法
    redis远程密码连接
    centos7上定时将mysql数据导出并且发送到指定的邮箱
  • 原文地址:https://www.cnblogs.com/liujitao79/p/4372077.html
Copyright © 2020-2023  润新知