Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing user defined argument to RPM is possible while installing?

Passing User defined argument to RPM is possible while installing?.

for example:

~>rpm -i sample.rpm -license_path=/path/

or

~>rpm -i -license_path=/path/ sample.rpm

or

~>rpm -i -somearg sample.rpm

-Sakthi

like image 219
Sakthivadivel Anbalagan Avatar asked Jun 26 '12 10:06

Sakthivadivel Anbalagan


People also ask

What is the option to install with RPM?

RPM is a command-line utility for managing packages on Unix/Linux systems. It allows you to install, query, update, verify and remove RPM packages. It is the default package manager for Red Hat based systems and only works with the . rpm format.

Which command is used to install any RPM package?

Install the RPM Package without the Dependencies The command is mentioned as follows: # rpm -ivh --nodeps apacheds-2.0.

Can you use yum to install RPM?

Install RPM File with Yum Alternately, you can use the yum package manager to install . rpm files. The localinstall option instructions yum to look at your current working directory for the installation file. Note: YUM stands for Yellowdog Updater Modified.

How force RPM install?

--replacepkgs: Install the Package Even If Already Installed The --replacepkgs option is used to force RPM to install a package that it believes to be installed already. This option is normally used if the installed package has been damaged somehow and needs to be fixed up.


2 Answers

RPMs aren't meant to take user defined arguments.

See RPM - Install time parameters

Another similar question is at https://superuser.com/questions/408852/is-it-possible-to-get-users-input-during-installation-of-rpm

One workaround is to have the rpm's postinstall script ask for input from stdin, in which case you can pass in the answers by redirecting stdio from a file or here document.

>rpm -i sample.rpm <<__NOT_RECOMMENDED__
somearg
__NOT_RECOMMENDED__
like image 62
pwan Avatar answered Nov 07 '22 05:11

pwan


It looks like you are trying to create a relocatable RPM.

In the preamble of your .spec file, put the prefix of the file path that can be relocated. For example, if the full path to your file is

/base/path/to/my/file

then /base can be changed during RPM installation but /path/to/my/file will remain the same.

Here's what you put in your .spec file:

#Preamble: Summary, Name, etc.
Prefix: /base

Ensure that you mention this prefix while listing all relocatable files in the %install and %files sections in the .spec file. There are conditions where a relocatable RPM may not work, so check out these things to consider as well.

%files
%{prefix}/path/to/my/file

Now when you install the RPM, you can specify a different prefix.

rpm -i sample.rpm  --prefix /tmp

This will install the file in /tmp/path/to/my/file.

like image 23
nohup Avatar answered Nov 07 '22 06:11

nohup