LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   [RPM Script] How to define the global variable (https://www.linuxquestions.org/questions/linux-software-2/%5Brpm-script%5D-how-to-define-the-global-variable-4175486670/)

thomas2004ch 12-03-2013 05:14 AM

[RPM Script] How to define the global variable
 
Hi,

We know the RPM script (spec) has normally following sections auch as

Code:

...
%description
...

%pre
...

%install
...

%post
...


etc.

I wonder where to define a global variable so that is will used in every section?

pan64 12-03-2013 06:00 AM

%define name value

thomas2004ch 12-03-2013 06:40 AM

How about %define name ? Because I am not sure what value it should be at this moment. The value should be given during installation. Example:

Code:


...
%define HOSTNAME
...

%pre
HOSTNAME=`hostname`

...

Is this OK?

pan64 12-03-2013 06:43 AM

%define HOSTNAME %(hostname)
probably works, but I'm not really sure what do you need.


All times are GMT -5. The time now is 04:05 AM.