rpmbuild安装:无法创建目录

时间:2013-05-15 07:59:26

标签: packaging rpm

我正在创建一个RPM文件但是在使用安装时我得到了一些权限错误。

这是我的spec文件:

%define buildroot %{_tmppath}/nagios-1-1-root-%(%{__id_u} -n)

Summary: Nagios blabla
Name: nagios
Version: 1
Release: 1
License: PROPRIETARY
Group: Applications/Accessories
Source: nagios-1.tar.gz
Packager: Nicholas Lievens <lievens.nicholas@gmail.com>
AutoReqProv: no
Requires: gcc gcc-c++ glibc glibc-common glibc-devel gd gd-devel php53 php53-cli php53-mysql php53-gd php53-pdo graphviz httpd libdbi-dbd-mysql libdbi-devel mysql mysql-server mysql-devel git

%description
Nagios!
%prep
%setup

%build
./configure --with-init-dir=/etc/init.d --with-nagios-user=nagios --with-nagios-group=nagios
make all

%install
make install DESTDIR=${RPM_BUILD_ROOT}
make install-init DESTDIR=${RPM_BUILD_ROOT} 
make install-config DESTDIR=${RPM_BUILD_ROOT}
make install-commandmode DESTDIR=${RPM_BUILD_ROOT}
make install-webconf DESTDIR=${RPM_BUILD_ROOT}
make install-devel DESTDIR=${RPM_BUILD_ROOT}

#htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
%files
%defattr(755,root,root)
/etc/init.d/nagios
%{_prefix}/var
%{_prefix}/var/spool/checkresults
%{_prefix}/var/rw
%{_prefix}/etc
%{_prefix}/bin
%{_prefix}/sbin
%{_prefix}/libexec
%{_prefix}/lib
%{_prefix}/include/nagios
%{_prefix}/share
%{_prefix}/etc
%defattr(644,root,root)
%config(noreplace) %{_prefix}/etc/*.cfg
%defattr(750,root,nagios)
/etc/nagios
/etc/nagios/objects
%defattr(755,nagios,nagios)
/var/log/nagios
/var/log/nagios/archives
%defattr(2775,nagios,nagios)
/var/spool/nagios
###%files www
%defattr(755,root,root)
%{_prefix}/sbin
%{_prefix}/sbin/*
%{_prefix}/share/nagios
%defattr(-,root,root)
%{_prefix}/share/nagios/*
%config(noreplace) /etc/httpd/conf.d/nagios.conf
%defattr(-,root,root)
%{_prefix}/include/nagios
%{_prefix}/include/nagios/locations.h

有些事情只是出于调试原因而被注释掉。有人可以告诉我为什么要输出:

  

安装:无法创建目录`/ var / spool / nagios':权限   拒绝错误:/var/tmp/rpm-tmp.80635退出状态不正确(%install)

1 个答案:

答案 0 :(得分:0)

您是否尝试在RHEL 5上构建此功能?如果是这样,您需要在标题中的某处添加此行:

BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

否则将不会填充$RPM_BUILD_ROOT