LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-27-2011, 03:45 PM   #1
wills
LQ Newbie
 
Registered: Jun 2008
Posts: 28

Rep: Reputation: 0
RPM spec file to replace existing config files.


I want to build an RPM that I can use to replace existing files on a host to authenticate against LDAP. I'm painfully aware of the fact that I can do the same with a bash script, puppet, etc.

Here is what I have:

Code:
%prep
# no setup

%build
# no building

%install
#rm -rf $RPM_BUILD_ROOT

install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/ldap.conf
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/openldap/ldap.conf
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d/system-auth
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/nsswitch.conf

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%config %{_sysconfdir}/openldap/ldap.conf
%config %{_sysconfdir}/ldap.conf
%config %{_sysconfdir}/pam.d/system-auth
%config %{_sysconfdir}/nsswitch.conf
This does not work because it conflicts with file from existing OS package (e.g. Glibc, openldap, etc.). Is there a way to safely backup the existing files, and then replace them with my own?

Should I be using the Patch method instead?
 
Old 09-27-2011, 04:59 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
Quote:
Originally Posted by wills View Post
This does not work because it conflicts with file from existing OS package (e.g. Glibc, openldap, etc.). Is there a way to safely backup the existing files, and then replace them with my own?
Obviously it should conflict as those config files are managed by RPM (%config). To understand what happens in terms of backing up config files see for instance this (couldn't locate it quickly in the official RPM docs).


Quote:
Originally Posted by wills View Post
Should I be using the Patch method instead?
In short: yes.
 
Old 09-29-2011, 04:08 AM   #3
mikey99
Member
 
Registered: Nov 2008
Location: UK
Distribution: RHEL, Fedora
Posts: 68

Rep: Reputation: 12
Using rpm to manage config files is wrong wrong wrong :-) It may not be as easy as you think.

However, if you really want to do it, take a look at this presentation for ideas.

RPM-ifying-System-Configurations.pdf

Mike...
 
  


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
LFS RPM SPEC files: Binutils RPM spec for x86 arch nocountryman Linux From Scratch 2 10-25-2010 09:09 AM
How to get spec file from existing rpm? shaybery Linux - Software 4 01-11-2009 06:44 AM
writing spec file for RPM to move files Help Me Linux - Newbie 2 05-08-2006 12:58 PM
%file attribute for RPM SPEC files Brian of Gep Linux - Software 3 06-18-2004 04:51 AM
%file attribute for RPM SPEC files Brian of Gep Fedora 0 06-15-2004 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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