LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-02-2014, 07:44 AM   #1
awfun
LQ Newbie
 
Registered: Apr 2014
Posts: 2

Rep: Reputation: Disabled
RPM spec file script: %define command


Hello.
I'm trying to create a SPEC file for some program, that might be installed on "server", "client", "other" types of computers. Each type has it's own list of files and actions during installation and uninstallation.
SPEC file describes %install, %pre, %post, %preun, %postun scripts. I want %install script to define a value, that could be used by other scripts, even after reboot.
Example:
Code:
%install
  type="server"
  define _type "123${type}"
  echo "%{_type}"
%pre
  echo "%{_type}"
output:
Code:
install:
  123server
pre:
  123
Of course, %pre scipt does not know the value of ${type} variable. How can I put the value of a local variable to defined one?

Thank you for your answers.
 
Old 04-04-2014, 01:46 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Be careful: %define's are used at package creation time and %install is used to drive package creation, not the package installation afterwards on a (any) system. Often packages following the client - server paradigm are split into sub-packages (openssh-server, openssh-client) so IMHO that's the way to go. If the recommended way of creating different packages per install type doesn't apply (since it's just an arbitrary term you use in scripts) then there's nothing, except placing something on the file system, that you can use, like say 'echo server > %{DOCDIR}/install_type' in your %post section. If you use that or something similar beware of %reloc.
 
  


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
[RPM-Spec] Script in %prep thomas2004ch Linux - Software 5 11-26-2013 04:51 AM
LFS RPM SPEC files: Binutils RPM spec for x86 arch nocountryman Linux From Scratch 2 10-25-2010 10:09 AM
[SOLVED] rpm spec file to overwrite my service script yaplej Programming 3 05-06-2010 12:52 PM
RPM SPEC file install script run anti43 Linux - Software 2 05-05-2009 08:17 AM
rpm spec file help AutoC Fedora 3 01-30-2008 09:25 AM


All times are GMT -5. The time now is 08:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration