user4889345
user4889345

Reputation:

How to make one RPM install another RPM

I have created an RPM file which runs perfectly fine. I would like to add a dependency to it meaning that when I try to install the RPM, it forces me to install another RPM as a prerequisite.

Google does not tell me much.

My spec file looks like ::

[root@vm1-msdp SPECS]# cat iamcac.spec 
# Don't try fancy stuff like debuginfo, which is useless on binary-only
# packages. Don't strip binary too
# Be sure buildpolicy set to do nothing
%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress
%define _unpackaged_files_terminate_build 0

Summary: A very simple toy bin rpm package
Name: iam_cac
Version: 1.0
Release: 1

SOURCE0 : /root/rpmbuild/SOURCES/iam_cac-1.0.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

License: OtherLicense

%description
%{summary}

%prep
%setup -q

%build
# Empty section.

%install
rm -rf %{buildroot}
mkdir -p  %{buildroot}

# in builddir
cp -a * %{buildroot}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
/opt/msdp/ca/iam_cac/

I would like it to install java-1.0.rpm before it installs itself.

Upvotes: 2

Views: 1429

Answers (1)

Thomas Dickey
Thomas Dickey

Reputation: 54505

There are two parts:

  • you can add a dependency (the Requires tag) to your spec-file, but
  • the rpm program only does one install/uninstall operation at a time. Use yum (or dnf) with a repository to get that behavior.

Upvotes: 3

Related Questions