Creating RPM spec file from compiled binary files

2019-08-08 17:56发布

问题:

Environment is AIX 7.0 RPM Version 3.0.5 . I am very new to Unix world, Please be patient with my ignorance.

We have 3 different types of files to be packaged as RPM.

• Source/binary/*.bainaryfiles (around 160 of them)

• Source/ui/*.mm (No of files 2)

• Source/scripts/*.sh (10 to 20)

These files are compiled for the target server and these are in binary form and we don’t want to compress these files to tar.

When the install happens on the Generated RPM using rpmbuild the .binaryfiles ,.ui and .sh files have to go to different directories on the target server

No build has to happen since its already built.

Can anybody provide me the .spec file sample and the steps. can we run rpmbuild without root access? Can we run the install of the rpm without root access?

回答1:

Here is an example that doesn't have any build section.

Name: special-package
Version: 0.0
Release: 0.1
Summary: This is a special package

Group: Devlopment/Tools
License: Special Proprietary
BuildArch: noarch

%description
This package contains some special stuff

%install
# e.g., on the target server path_to_all_binary_files=/usr/share/special/bin
%{mkdir_p} %{buildroot}%{_path_to_all_binary_files}

# In case of a copy, file permissions will be copied as it is.
# You can also try 'install -m 755 $RPM_SOURCE_DIR/....'
# 'man install' for more information
%{__cp} $RPM_SOURCE_DIR/binary/*.binaryfiles %{buildroot}%{_path_to_all_binary_files}
# Similarly do this for other sets of files 

%files
%{_path_to_binary_files}/*.binaryfiles
%{_path_to_sh_files}/*.sh

%changelog
* Tue Mar 14 2017 Name Surname<name.surname@email.com>
 - First build of the special package

This one is by Fedora, but I think a lot of guidelines apply in general https://fedoraproject.org/wiki/How_to_create_an_RPM_package