Pergunta

This is getting rather maddening - I'm trying to build an RPM out of some BASH scripts which work as Nagios plugins. I keep getting:

error: Installed (but unpackaged) file(s) found:
    /usr/lib64/nagios/plugins/netappassigncheck
    /usr/lib64/nagios/plugins/netappassignprep

In the %files directive of my spec file I have tried most of the combos that have been suggested here and on various other internet forums:

  • /usr/lib/nagios/plugins/*
  • /usr/lib/nagios/plugins/netappassigncheck
  • /usr/lib/nagios/plugins/netappassignprep
  • %dir /usr/lib/nagios/plugins/

And currently I am on

%dir %{_libdir}/nagios/plugins/ 

This is why my most recent error output is lib64, previous errors when quoting the full path were /usr/lib/...

These are the only 2 files that should make up the package as well.

Here is my .spec file

Name: netappautoassign
Summary: A set of Nagios Plugins for automatically assigning disks to a Netapp
Version: 1.0
Release: 1
License: %{license}
Group: Applications/System
Source: %{source}
URL: Reserved
Vendor: %{vendor}
Packager: %{packager}
BuildArch: noarch
Requires: bash, grep, util-linux, coreutils, expect, openssh-clients, bc, sed
Provides: netappassignprep, netappassigncheck
%description
Since Netapp's autoassign function may lead to disks being assigned to the
wrong head these NAGIOS plugins will ensure disks are added to the correct
head when replaced.

%prep
%setup -q

%build

%install
rm -rf %{buildroot}
install -d %{buildroot}%{_libdir}/nagios/plugins
cp netappassigncheck %{buildroot}%{_libdir}/nagios/plugins/
cp netappassignprep %{buildroot}%{_libdir}/nagios/plugins/

%files
%defattr(755,root,root,755)
%dir %{_libdir}/nagios/plugins/

%clean
rm -rf %{buildroot}

%post

And here's my ~/.rpmmacros

%_topdir %(echo $HOME)/rpmbuild
%_tmppath %{_topdir}/tmp
%buildroot %{_tmppath}/%{name}-%{version}

%license RESERVED
%source %{name}-%{version}.tar.gz
%vendor REDACTED
%packager REDACTED

EDIT - SOLVED

I'm not sure if this is a bug or desired behaviour, but it would appear that during the build setion the %{buildroot} variable was not being read in from .rpmmacros Having moved this variable into the main spec file the RPM is now built.

Foi útil?

Solução

I'm not sure if this is a bug or desired behaviour, but it would appear that during the file verification section, it was reading in all the current active plugins under the root file system and not the %{buildroot}.

I suspected that the %{buildroot} variable was not being read in from .rpmmacros at this stage, although it was for all other stages.

I moved the declaration of %{buildroot} into my main .spec file and the build is now working!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top