Issue while creating RPM

I am trying to create an RPM that basically creates a JBOss container. At the end it copies folders and files in a particular directory structure.

    /root/rpmbuild/SOURCES
    [root@vm1-msdp SOURCES]# tree cac-1.0
    cac-1.0
     opt
         msdp
             ca
                 iam_cac
                     bin
                    **  app.sh
                    **  offset
                    **  start.sh
                    **  status.sh
                    **  stop.sh

I have created cac-1.0.tar.gz under /root/rpmbuild/SOURCES.

On the node on which I install this RPM, I want a directory structure like

   /opt/msdp/ca/iam_cac/bin/*

My spec file looks like:

    # Don't try fancy stuff like debuginfo, which is useless on binary-only
    # packages. Don't strip binary too
    # Be sure buildpolicy set to do nothing
    %define        __spec_install_post %{nil}
    %define          debug_package %{nil}
    %define        __os_install_post %{_dbpath}/brp-compress
    %define _unpackaged_files_terminate_build 0

    Summary: A very simple toy bin rpm package
    Name: iam_cac
    Version: 1.0
    Release: 1

    SOURCE0 : cac-1.0.tar.gz

    BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

    %description
    %{summary}

    %prep
    %setup -q

    %build
    # Empty section.

    %install
    rm -rf %{buildroot}
    mkdir -p  %{buildroot}

    # in builddir
    cp -a * %{buildroot}

    %clean
    rm -rf %{buildroot}

    %files
    %defattr(-,root,root,-)

I then run;

    # rpmbuild -ba SPECS/iamcac.spec 
    

    Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.jKBlSc
    + umask 022
    + cd /root/rpmbuild/BUILD
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cd /root/rpmbuild/BUILD
    + rm -rf iam_cac-1.0
    + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/cac-1.0.tar.gz
    + /bin/tar -xf -
    + STATUS=0
    + '[' 0 -ne 0 ']'
    + cd iam_cac-1.0
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.H9BYEA
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd iam_cac-1.0
    + LANG=C
    + export LANG
    + unset DISPLAY
    + exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.OhchxY
    + umask 022
    + cd /root/rpmbuild/BUILD
    + '[' /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64 '!=' / ']'
    + rm -rf /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    ++ dirname /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    + mkdir -p /root/rpmbuild/BUILDROOT
    + mkdir /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    + cd iam_cac-1.0
    + LANG=C
    + export LANG
    + unset DISPLAY
    + rm -rf /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    + mkdir -p /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    + cp -a opt /root/rpmbuild/BUILDROOT/cac-1.0-1.x86_64
    Processing files: iam_cac-1.0-1.x86_64
    Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/iam_cac-1.0-1.x86_64
    warning: Installed (but unpackaged) file(s) found:
       /opt/msdp/ca/iam_cac/bin/app.sh
       /opt/msdp/ca/iam_cac/bin/offset
       /opt/msdp/ca/iam_cac/bin/start.sh
       /opt/msdp/ca/iam_cac/bin/status.sh
       /opt/msdp/ca/iam_cac/bin/stop.shWrote: /root/rpmbuild/SRPMS/iam_cac-1.0-1.src.rpm
    Wrote: /root/rpmbuild/RPMS/x86_64/cac-1.0-1.x86_64.rpm
    Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.5u5vYq
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd iam_cac-1.0
    + rm -rf /root/rpmbuild/BUILDROOT/iam_cac-1.0-1.x86_64
    + exit 0

It generates :

    /root/rpmbuild/RPMS/x86_64/iam_cac-1.0-1.x86_64.rpm

but it is only 1.7KB in size and when installed, does not make the file structure I desire.

What else am I missing ?

Here is your problem:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/iam_cac-1.0-1.x86_64
    warning: Installed (but unpackaged) file(s) found:
       /opt/msdp/ca/iam_cac/bin/app.sh
       /opt/msdp/ca/iam_cac/bin/offset
       /opt/msdp/ca/iam_cac/bin/start.sh
       /opt/msdp/ca/iam_cac/bin/status.sh
       /opt/msdp/ca/iam_cac/bin/stop.shWrote: /root/rpmbuild/SRPMS/iam_cac-1.0-1.src.rpm

You need to list the files you wish to include in the %files section. Something like:

%files
/opt/msdp