zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    前端页面的防抖与节流
    vue3.0 响应式原理
    cssBEM命名规范及常用CSS class 命名
    vue2.x 响应式原理
    npm 相关命令
    Node之 fs
    Node 之 Buffer
    Node之path
    Node之process
    Node.js 如何处理 ES6 模块
  • 原文地址:https://www.cnblogs.com/liujitao79/p/4372077.html
Copyright © 2011-2022 走看看