Redhat

我無法使用 rpmbuild 建構 nagios-3.5.0 RPM @RHEL6

  • July 27, 2013

我無法使用 nagios 3.5.0 建構 RPM(最後一個對我有用的是 3.2.3):

# md5sum nagios-3.5.0.tar.gz 
aeef195d2033cc362bf6cb972bcc8f07  nagios-3.5.0.tar.gz
# rpmbuild -tb nagios-3.5.0.tar.gz 
warning: line 40: prereq is deprecated: PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.VOVWNc
+ umask 022
+ cd /root/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /root/rpmbuild/BUILD
+ rm -rf nagios-3.5.0
+ /usr/bin/gzip -dc /root/nagios-3.5.0.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd nagios-3.5.0
/var/tmp/rpm-tmp.VOVWNc: line 38: cd: nagios-3.5.0: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.VOVWNc (%prep)


RPM build errors:
   line 40: prereq is deprecated: PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
   Bad exit status from /var/tmp/rpm-tmp.VOVWNc (%prep)
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.4 (Santiago)
# uname -a
Linux XXX.XXX.XXX 2.6.32-358.6.2.el6.x86_64 #1 SMP Tue May 14 15:48:21 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# rpm -q rpm-build
rpm-build-4.8.0-32.el6.x86_64
# 

有什麼想法/建議嗎?

Nagios (rpmbuild) 企業 Linux | 亞歷克薩斯的部落格

tar -zxf nagios-3.5.0.tar.gz
rm nagios-3.5.0.tar.gz
mv nagios nagios-3.5.0
sed -i 's/datarootdir/datadir/' nagios-3.5.0/nagios.spec
tar -czf nagios-3.5.0.tar.gz nagios-3.5.0
rpmbuild -tb nagios-3.5.0.tar.gz
ls rpmbuild/RPMS/*/nagios-3.5.0*rpm

正如您在上面所說的,問題是不再維護規範文件

# zcat nagios-3.5.0.tar.gz | tar -tf - | head -3
nagios/
nagios/OutputTrap.pm
nagios/p1.pl

如您所見,文件夾名稱為 nagios,但在規範文件中嘗試將 dir 更改為 nagios-3.5.0

+ cd nagios-3.5.0

如果您不能使用 EPEL 等第三方儲存庫,我建議您從http://dl.fedoraproject.org/pub/epel/6/SRPMS/nagios-3.5.0-1.el6.src獲取規範文件.rpm並建構您自己的包

引用自:https://serverfault.com/questions/525928