[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpmorg-list
Subject:    Getting realocated dir in the postinstall (or other) scriptlets ?
From:       cdr53x () free ! fr (cdr53x at free ! fr)
Date:       2016-01-11 14:33:55
Message-ID: 560326350.660404168.1452522835765.JavaMail.root () spooler4-g27 ! priv ! proxad ! net
[Download RAW message or body]

Worked like a charm , thank you very much Panu ! 

----- Mail original -----
De: "Panu Matilainen" <pmatilai at laiskiainen.org>
?: rpm-list at lists.rpm.org
Envoy?: Jeudi 7 Janvier 2016 19:01:42
Objet: Re: Getting realocated dir in the postinstall (or other) scriptlets ?

On 01/07/2016 06:42 PM, cdr53x at free.fr wrote:
> Hi,
> 
> I'm working on an RPM package that deploys files to /opt and /etc. In most of the \
> cases it works perfectly, excepted that for a given environment, where writing to \
> /etc is prohibited  .... 
> So I used Relocations in order to deploy the /etc files in some other location :
> 
> Relocations : /opt /etc

I assume you mean (the above is how rpm -qi shows it though):

Prefixes: /opt /etc

> 
> By specifying --relocate option I can deploy the /etc files into another location :
> 
> rpm -ivh --relocate /etc=/my/path/to/etc mypackage.rpm
> 
> Now the issue is that in the postinstall script, there are some hard coded \
> references to /etc that obviously don't get replaced when the package is deployed : \
>  echo `hostname --fqdn` > /etc/myapp/host.conf
> ( this is just an example )
> 
> I hope that there is a way (keyword, ... ) to use instead of hard coded paths in \
> order to perform the substitutions during rpm execution.

The prefixes are passed to scriptlets via $RPM_INSTALL_PREFIX<n> 
environment variables, <n> is the index of supported prefixes starting 
from zero. So in the above,

/opt is $RPM_INSTALL_PREFIX0
/etc is $RPM_INSTALL_PREFIX1

So the scriptlet example becomes:

     echo `hostname --fqdn` > $RPM_INSTALL_PREFIX1/myapp/host.conf

	- Panu -

> If you have any information on this I'd really appreciate some help.
> 
> Thanks per advance
> _______________________________________________
> Rpm-list mailing list
> Rpm-list at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-list
> 

_______________________________________________
Rpm-list mailing list
Rpm-list at lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic