title: rpmbuild: Installed (but unpackaged) file(s) found - Multiple options tried
body: <p>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:</p>
  
  <pre><code>error: Installed (but unpackaged) file(s) found:
      /usr/lib64/nagios/plugins/netappassigncheck
      /usr/lib64/nagios/plugins/netappassignprep
  </code></pre>
  
  <p>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:</p>
  
  <ul>
  <li>/usr/lib/nagios/plugins/*</li>
  <li>/usr/lib/nagios/plugins/netappassigncheck</li>
  <li>/usr/lib/nagios/plugins/netappassignprep</li>
  <li>%dir /usr/lib/nagios/plugins/</li>
  </ul>
  
  <p>And currently I am on </p>
  
  <pre><code>%dir %{_libdir}/nagios/plugins/ 
  </code></pre>
  
  <p>This is why my most recent error output is lib64, previous errors when quoting the full path were /usr/lib/...</p>
  
  <p>These are the only 2 files that should make up the package as well.</p>
  
  <p>Here is my .spec file</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And here's my ~/.rpmmacros</p>
  
  <pre><code>%_topdir %(echo $HOME)/rpmbuild
  %_tmppath %{_topdir}/tmp
  %buildroot %{_tmppath}/%{name}-%{version}
  
  %license RESERVED
  %source %{name}-%{version}.tar.gz
  %vendor REDACTED
  %packager REDACTED
  </code></pre>
  
  <p><strong>EDIT - SOLVED</strong></p>
  
  <p>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.</p>