I have binary file that I would like place under /etc/myapp/bin/app
Here is my SPECS/app.spec file
%define _topdir /root/rpmbuild
%define name my-app
%define release 2
%define version 2.1
%define buildroot %{_topdir}/%{name}-%{version}
Name: %{name}
Summary: Sample Application
License: Private
Version: %{version}
Release: %{release}
Group: Applications/Tools
BuildArch: x86_64
BuildRoot: %{buildroot}
URL: https://www.my-app.com
Source0: %{_topdir}/SOURCES/%{name}-%{version}.tar.gz
%description
My App Desc
%prep
%setup -q
%build
%install
ls
cp etc/my-app/bin/app /etc/my-app/bin
cp etc/init.d/my-app /etc/init.d
chmod +x /etc/my-app/bin/app
chmod +x /etc/init.d/my-app
%files
%defattr(-,root,root)
%post
/etc/init.d/my-app start
/sbin/chkconfig --add /etc/my-app/bin/app
%preun
#last removal
service %{name} stop > /dev/null 2>&1
rm -rf /etc/my-app
rm -f /var/log/my-app
/sbin/chkconfig --del %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
# end mhash spec
And then I do
rpmbuild -ba /root/rpmbuild/SPEC/app.spec
This builds 3 files
/root/rpmbuild/SRPMS/x86_64/my-app-2.1-2.src.rpm
/root/rpmbuild/RPMS/x86_64/my-app-2.1-2.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/my-app-debuginfo-2.1-2.x86_64.rpm
The size of the .rpm
file is just 4kb where src package itself is 13MB.