I'm trying to write a spec RPM file to build an RPM package. Here is in essence my spec file:
[...]
Requires: nodejs java-1.8.0-openjdk java-1.8.0-openjdk-devel log4j
%define _rpmdir ../
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%define _unpackaged_files_terminate_build 0
%pre
[Some script]
%post
[Some script]
%preun
[Some script]
%postun
[Some script]
%install
[...]
%files
[...]
I've managed to install the package dependencies with the preamble Requires
expect one that doesn't exist as a yum package
(tomcat8). I found on the internet that the way to install it on centOS is:
wget https://harbottle.gitlab.io/harbottle-main/7/x86_64/00853071-tomcat8/tomcat8-8.5.37-2.el7.harbottle.x86_64.rpm
rpm -ivh tomcat8-8.5.37-2.el7.harbottle.x86_64.rpm
But where should I put it in the spec file? I tried to put it in the %pre
script, but there is a lock on rpm
that prevent its use. I tried to put it in the %install
part, but it didn't seem right. Can you please help me to fix this problem? Is there a way to still put it in the Requires
preamble?
Thanks!
this is not the way you should manage those dependencies. You should search for a way to make this rpm available in you repositories. I see multiple options:
yum-config-manager --add-repo https://harbottle.gitlab.io/harbottle-main/7/x86_64/
. Now your yum
will be able to find the tomcat8 rpm by itself