LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-14-2014, 03:55 AM   #1
r0tty
Member
 
Registered: May 2011
Posts: 33

Rep: Reputation: 1
File ownership from RPM spec file


Hi,

How can I write a spec file so that after installation of the package the files belong to a user defined by an external factor?

The use case is that the files delivered by a package belong to different user accounts on prod servers than on dev and test.

Thanks in advance for any assistance.

Regards,
Rotty
 
Old 11-14-2014, 01:31 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,149

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
You can do chown in a script in the %post section based on something present or absent on the target system.
For example it could install the files for the production case, then in %post check for a file named /tmp/MYRPM_TEST.
 
Old 11-17-2014, 03:06 AM   #3
r0tty
Member
 
Registered: May 2011
Posts: 33

Original Poster
Rep: Reputation: 1
Hi,

Thanks for that.

I could write quite a simple bit of bash for the %post section that uses the hostname to determine if it is a prod, test or dev install. From that I can work out which account to chown the files to.

However, from within the %post section how can I enumerate the files being dropped by the RPM? Without that I will have hard code all the files in the chown command (or top level directories if I'm using 'chown -R'), which is a problem for maintainability.

Thanks,
Rotty
 
Old 11-17-2014, 05:57 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,149

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
I'm not sure if this would work, but you could try 'rpm -qpl rpmname' to list files.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract spec file from rpm file nayankk Programming 18 11-12-2015 02:11 PM
rpm spec file help AutoC Fedora 3 01-30-2008 08:25 AM
rpm spec file alrawab Linux - General 2 03-28-2007 06:39 AM
RPM Spec file adddy Linux - Software 8 11-07-2006 05:02 AM
RPM Spec file creation: %file section question davidas Linux - Newbie 0 03-16-2004 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:44 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
Open Source Consulting | Domain Registration