Closed tlo8640 closed 5 years ago
the following line in spec file fixed the wrong requirements for me:
%if 0%{?el6}
%filter_from_requires /perl(a[n]*)/d
%filter_setup
%endif
So finally you could build the RPM package?
Hello,
yes, at least it worked fine for rhel6, too. So, it's not a bug in your code, more an info for other people who need/want to built rpms from your code. Thanks and regards Thomas
Can you post the full spec file? Maybe we should add it to the master branch as additional info, THX
Hello, here it comes (i removed the changelog, there are only my entries where I tried getting the spec file running) I've built with tito (https://github.com/dgoodwin/tito). It helped me, keeping the files in git and creating tgz, srpm and rpm) there is an additional sudo entriy needed, I post it under the Spec file, because the script needs root rights for calling ipmi-sel. You should take a look at "License", "Packager", "Vendor" that it fits your needs. The other entries could need a closer look, too. :-) I'm not a hero of rpm packaging, but mostly my packages are working. This one is only tested on Redhat EL 6(64 Bit) and 7
Name: check_ipmi_sensor
Version: 3.12
Release: 6%{dist}
Summary: ipmi sensors icinga check plugin
Packager: Thomas Loescher, <thomas.loescher@swisscom.com>
Vendor: Thomas-Krenn AG
Group: Application/System
License: GPLv3
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
Requires: perl-IPC-Run
Requires: perl-IO-Tty
Requires: freeipmi
%if 0%{?el6}
%filter_from_requires /perl(a[n]*)/d
%filter_setup
%endif
%description
check_plugin for hardware monitoring using the ipmi interface
%prep
%setup -q
%build
%install
%{__install} -D check_ipmi_sensor $RPM_BUILD_ROOT%{_libdir}/nagios/plugins/check_ipmi_sensor
%{__install} -D sudo_icinga_ipmi $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/icinga_ipmi
%{__install} -D changelog.txt $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/changelog.txt
%{__install} -D COPYING $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/COPYING
%{__install} -d contrib $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/contrib
%{__install} -D contrib/default-combinedgraph.template $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/contrib/default-combinedgraph.template
%files
%defattr(0664,root,root)
%attr(0755,root,root) %{_libdir}/nagios/plugins/check_ipmi_sensor
%attr(0660,root,root) %config(noreplace) %{_sysconfdir}/sudoers.d/icinga_ipmi
%{_defaultdocdir}/%{name}/changelog.txt
%{_defaultdocdir}/%{name}/COPYING
%{_defaultdocdir}/%{name}/contrib/default-combinedgraph.template
%changelog
* Fri Oct 12 2018 Thomas Loescher <thomas.loescher@swisscom.com> 3.12-6
- remove AutoReq, use %filter_from_requires for rhel6 perl dependencies
(thomas.loescher@swisscom.com)
here comes the sudoers include, If someone thinks about using this script with nrpe, additional lines with User nrpe or nagios (depends what user is running nrpe) should added. currently this file is located in the root of the git repo.
# icinga is allowed to run check_ipmi_sensor
icinga ALL=NOPASSWD: /usr/sbin/ipmi-sel *,/usr/sbin/ipmi-sensors *
Hope it helps Regards Thomas
Thank you @tlo8640 also from my side for providing the spec file, I added it with commit a00ce9ee0e5813879335b807b21ae6c81de581c7.
Best regards Thomas
Hello,
I tried to create rpms from this project for rhel 6 and 7. It worked for rhel7, but it failed for rhel 6, because of a strange problem of automatic dependency resolution for perl modules in the rpm build process. This feature (automatic dependency resolution) tries to create a dependency list of perl modules for the package for installing them when you will install the built rpm package on a system. I don't know how exactly this feature works, but somehow it scans the code for the "use" keyword and takes the word after use as a needed module name and add this to the dependency list. If you grep your script for "use" at the beginning of a line you will find some lines:
the created rpm cannot be installed on rhel 6:
Perhaps it's a problem of the rpm macros for redhat 6 only, because it works with redhat 7. Disabling automatic dependency resolution solves this proble. But If you want this, you have to move the "use" away from the beginning of the line or replace it with another word (e.g. "take"). But only where it is not the part of the perl code! :-)
Regards Thomas
P.S. Thank you for this script, it helps us a lot!