LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2013, 05:14 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
[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?
 
Old 12-03-2013, 06:00 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,691

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
%define name value
 
Old 12-03-2013, 06:40 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
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?
 
Old 12-03-2013, 06:43 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,691

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
%define HOSTNAME %(hostname)
probably works, but I'm not really sure what do you need.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
define a variable outside of a *.sh script... Mike_V Programming 11 09-10-2009 07:24 AM
Using global variable in awk (bash script) kopeda Programming 2 04-24-2007 01:47 AM
Define global variable maxmil Linux - Newbie 4 03-07-2006 10:36 AM
How can I define a global variable? kloss Linux - General 4 02-21-2006 04:30 AM
how to define a global variable Anniebaby Programming 1 11-09-2003 10:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration