我无法使用 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
#
有什么想法或建议吗?
答案1
正如你上面所说的,问题是 spec 文件不再维护
# zcat nagios-3.5.0.tar.gz | tar -tf - | head -3
nagios/
nagios/OutputTrap.pm
nagios/p1.pl
如您所见,文件夹名称是 nagios,但在 spec 文件中,它尝试将目录更改为 nagios-3.5.0
+ cd nagios-3.5.0
如果你不能使用 EPEL 等第三方仓库,我建议你从以下位置获取 spec 文件:http://dl.fedoraproject.org/pub/epel/6/SRPMS/nagios-3.5.0-1.el6.src.rpm并构建你自己的包
答案2
Nagios (rpmbuild) 企业 Linux | alexus 的博客
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