Is passing a user-specified argument to RPM possible during installation?

When installing? transition possible User-defined argument in RPM.

eg:

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

or

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

or

 ~>rpm -i -somearg sample.rpm 

-Sakthi

+6
source share
2 answers

RPMs are not intended to accept custom arguments.

See RPM - set time parameters

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

A workaround is to have rpm postinstall script request input from stdin, in which case you can pass responses by redirecting stdio from a file or document.

 >rpm -i sample.rpm <<__NOT_RECOMMENDED__ somearg __NOT_RECOMMENDED__ 
+6
source

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

In the preamble of your .spec file .spec place the path prefix for the file that you can move. For example, if the full path to your file is

 /base/path/to/my/file 

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

Here you put in your .spec file:

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

Make sure you specify this prefix by specifying all moveable files in the %install and %files sections of the .spec file. There are conditions under which a roaming RPM may not work, so check out these things and .

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

Now that you install RPM, you can specify a different prefix.

 rpm -i sample.rpm --prefix /tmp 

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

0
source

Source: https://habr.com/ru/post/919018/


All Articles