I use this spec file to use RPM files
Name: pack-agent
Version: 1.0
Release: 1%{?dist}
Summary: Linux Agent installation script
Group: Utilities
License: license
Source0: pack-agent-1.0.tar.gz
BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
%prep
%setup -q -n opt
%build
%install
#install -m 0755 -d $RPM_BUILD_ROOT/agent
#cp -ap agent/* $RPM_BUILD_ROOT/agent/
install -m 0755 -d %{buildroot}/opt
#cp -a * %{buildroot}/agent
cp -a * %{buildroot}/opt
%clean
rm -rf $RPM_BUILD_ROOT
%files
/opt
%defattr(-,root,root,-)
%attr(777, root, root) /opt/agent/bin/karaf
%doc
%changelog
But after install the files are not executable. I need to start file insight directories tree. Is there anyway to add chmod command insight the spec file and use it to set permissions after RPM install?