LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 12:46 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:05 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