[root@HADOOP-215 SPECS]# cat cfengine-2.2.10.spec
%define _prefix /usr/local/cfengine #重定义宏变量_prefix,rpm安装时将安装至此目录
Name: cfengine
Version: 2.2.10
Release: 1%{?dist}
Summary: cfengine by hean
Group: Applications/management
License: GPL
URL: http://www.cfengine.org/
Source0: %{name}-%{version}.tar.gz
Packager: hean <hean@staff.sina.com.cn>
BuildRequires: gcc,make
Requires: db4,openssl
%description
cfengine by hean. des
%prep
%setup -q
%build
%configure --with-berkeleydb=/usr/local/BerkeleyDB --prefix=/usr/local/cfengine
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/var/cfengine/bin
mkdir -p %{buildroot}/var/cfengine/inputs
mkdir -p %{buildroot}/var/cfengine/outputs
for id in `ls %{buildroot}/usr/local/cfengine/sbin/`;do ln -s /usr/local/cfengine/sbin/$id %{buildroot}/var/cfengine/bin/$id;done
cp %{buildroot}/usr/local/cfengine/share/cfengine/update.conf.example %{buildroot}/var/cfengine/inputs/update.conf
sed -i 's/ policyhost.*/policyhost = ( 10.7.5.10 )/g' %{buildroot}/var/cfengine/inputs/update.conf
%clean
%files
%defattr(-,root,root,-)
%doc
/usr/local/cfengine/lib64/libcfengine.a
/usr/local/cfengine/lib64/libcfengine.la
/usr/local/cfengine/sbin/cfagent
/usr/local/cfengine/sbin/cfdoc
/usr/local/cfengine/sbin/cfenvd
/usr/local/cfengine/sbin/cfenvgraph
/usr/local/cfengine/sbin/cfetool
/usr/local/cfengine/sbin/cfetoolgraph
/usr/local/cfengine/sbin/cfexecd
/usr/local/cfengine/sbin/cfkey
/usr/local/cfengine/sbin/cfrun
/usr/local/cfengine/sbin/cfservd
/usr/local/cfengine/sbin/cfshow
/usr/local/cfengine/share/cfengine/ChangeLog
/usr/local/cfengine/share/cfengine/INSTALL
/usr/local/cfengine/share/cfengine/NEWS
/usr/local/cfengine/share/cfengine/README
/usr/local/cfengine/share/cfengine/cf.chflags.example
/usr/local/cfengine/share/cfengine/cf.freebsd.example
/usr/local/cfengine/share/cfengine/cf.ftp.example
/usr/local/cfengine/share/cfengine/cf.groups.example
/usr/local/cfengine/share/cfengine/cf.linux.example
/usr/local/cfengine/share/cfengine/cf.main.example
/usr/local/cfengine/share/cfengine/cf.motd.example
/usr/local/cfengine/share/cfengine/cf.preconf.example
/usr/local/cfengine/share/cfengine/cf.services.example
/usr/local/cfengine/share/cfengine/cf.site.example
/usr/local/cfengine/share/cfengine/cf.solaris.example
/usr/local/cfengine/share/cfengine/cf.sun4.example
/usr/local/cfengine/share/cfengine/cf.users.example
/usr/local/cfengine/share/cfengine/cfagent.conf-advanced.example
/usr/local/cfengine/share/cfengine/cfagent.conf.example
/usr/local/cfengine/share/cfengine/cfengine.el
/usr/local/cfengine/share/cfengine/cfrc.example
/usr/local/cfengine/share/cfengine/cfrun.hosts.example
/usr/local/cfengine/share/cfengine/cfservd.conf.example
/usr/local/cfengine/share/cfengine/update.conf.example
/var/cfengine/bin/cfagent
/var/cfengine/bin/cfdoc
/var/cfengine/bin/cfenvd
/var/cfengine/bin/cfenvgraph
/var/cfengine/bin/cfetool
/var/cfengine/bin/cfetoolgraph
/var/cfengine/bin/cfexecd
/var/cfengine/bin/cfkey
/var/cfengine/bin/cfrun
/var/cfengine/bin/cfservd
/var/cfengine/bin/cfshow
/var/cfengine/inputs/update.conf
%changelog