LinuxQuestions.org
Visit Jeremy's Blog.
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, 06:14 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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, 07:00 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,580

Rep: Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342
%define name value
 
Old 12-03-2013, 07:40 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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, 07:43 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,580

Rep: Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342Reputation: 4342
%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 08:24 AM
Using global variable in awk (bash script) kopeda Programming 2 04-24-2007 02:47 AM
Define global variable maxmil Linux - Newbie 4 03-07-2006 11:36 AM
How can I define a global variable? kloss Linux - General 4 02-21-2006 05:30 AM
how to define a global variable Anniebaby Programming 1 11-09-2003 11:43 PM

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

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration