Reputation: 884
I have binary file that I would like place under /etc/myapp/bin/app
%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
rpmbuild -ba /root/rpmbuild/SPEC/app.spec
/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.
Upvotes: 2
Views: 3607
Reputation: 11489
To stop building debuginfo
packages, you need the following syntax at the top of your spec
file,
%define debug_package %{nil}
You have a couple of problems in the spec
file. You are not using a %{buildroot}
in your install section.
%install
# Create configuration directory for my-app
%{__mkdir_p} -m 0755 %{buildroot}/etc/my-app
# Use install that provides option for file permission
install -m 755 etc/my-app/bin %{buildroot}/etc/my-app/bin
install -m 644 etc/init.d/my-app %{buildroot}/etc/init.d/my-app
Make sure the package owns its files, otherwise you would get rpm build errors.
%files
%defattr(-,root,root)
%dir /etc/my-app
/etc/my-app/bin
/etc/init.d/my-app
Upvotes: 1