Re: How can i enter value during rpm -i and use them during the postinstall process?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 07, 2004 at 08:16:02PM -0800, Baz wrote:
> All,
> 
> I know I repeat this question already, but I really want to know the
> answers.
> 
> 1. I would like to install software_a.rpm with command "rpm -i
> software_a.rpm /opt/mydirectory servername". Where the
> "/opt/mydirectory" is a string indicate the installation directory.
> "servername" is a string value. Both values will be used during postinstall
> process.

Using /opt/mydirectory is doable using relocation.  You need to use Prefix
(note this *is not* %_prefix) as the hint to tell rpm it is locatable and
ensure no path layout dependancy.

http://www.rpm.org/max-rpm/ch-rpm-reloc.html has some docs.

If you use multiple prefixes 0..N I think you can get your servername in there
too by abusing relocate.

It's been a while since I've looked at this but for the first case:

In your spec say have:

Prefix: /opt/defaultdir

install to /opt/defaultdir

then rpm --i foo.rpm --relocate /opt/defaultdir=/opt/mydirectory

That's case 1 sorted.

Case 2: I'd need to check this but you may be able to simply do:

Prefix:  /opt/defaultdir
Prefix1: /opt/defaultserver

rpm --i foo.rpm --relocate /opt/defaultdir=/opt/mydirectory --relocate=/opt/servername

in %post use SERVERNAME=$(basename $RPM_INSTALL_PREFIX1) or some such to get
servername out.  I'd need to check whether enforcing prefix1 to exist in file
payload is done. If this doesn't work a non existent %dir somewhere sane using
%ghost would possibly work.  Note I wouldn't suggest this hack unless you were
%already using relocation.

> 2. In the postinstall section of the spec file. I can do something such as
> "echo $INSTALLDIR" and "echo $SERVERNAME" to proof that I have past those
> values and can be used.
To use the prefix in post:

RPM_INSTALL_PREFIX0 
...
RPM_INSTALL_PREFIXn 

Paul


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux