Quote:
Originally Posted by pradiptart
what i understood ,to create rpm means just to give some command which will be executed during the installation in the form of an RPM file.If this is correct then here I am doing the .out file by myself and just want a copy operation each time I install a rpm ,no validation checking nothing ,I have the .out file in the source folder before making this rpm ,The spec file is in /root/MYRPMBUILD/rpmbuild/SPECS,it is my own build dir.Is this correct.
|
No it is not:
- Do not build packages as root but as unprivileged user.
- Do not enter garbage or bogus information.
- Do not skip any packaging stage. Do things as they were intended.
- Respect OS-specific carriage returns and line endings for file contents (see 'dos2unix').
Code:
%define debug_packages %{nil}
%define debug_package %{nil}
%define name uselib
%define ver 1.2.3
%define rel 1
Name: %{name}
Summary: %{name} is a X library for purpose Y
Version: %{ver}
Release: %{rel}
Group: System Environment/Libraries
License: GPL
# Create a directory /home/pradiptart/redhat/SOURCES/uselib-1.2.3/ and place your source
# there and compress it to /home/pradiptart/redhat/SOURCES/uselib-1.2.3.tar.gz
Source0: %{name}-%{ver}.%{rel}.tar.gz
%description
%{name} is a X library for purpose Y.
%prep
%setup %{name}
%build
# You should have a Makefile or else you will enter the required commands to compile below:
%install
# Another good reason not to build as root:
rm -rf $RPM_BUILD_ROOT
# Local additions don't go in "opt/my" but "/usr/local" so libraries are in /usr/local/lib
install -d $RPM_BUILD_ROOT/usr/local/lib
install -m 0755 %{name}.so $RPM_BUILD_ROOT/usr/local/lib
ln -sf $RPM_BUILD_ROOT/usr/local/lib/%{name}.so $RPM_BUILD_ROOT/usr/local/lib/%{name}.so.%{ver}
# Fedora trick to populate files section:
find $RPM_BUILD_ROOT -not -type d -printf "%%%attr(%%m,root,root) %%p\n" | grep -v etc/ | sed -e "s|$RPM_BUILD_ROOT||g" -e "s|.*/man/.*$|\0.gz|g" >> %{_tmppath}/%{name}_contents.txt
%clean
# Another good reason not to build as root:
rm -rf $RPM_BUILD_ROOT
%files -f %{_tmppath}/%{name}_contents.txt
%changelog
* Thu Jun 21 2012 %{packager} - %{ver}.
- Release %{rel}.
Next time use BB code tags (like [CODE]code here[/CODE]) for both .spec file and output.
Before you ask questions please reread the links TobiSGD gave you. Most of what you saw above could have been learned from there.