Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-26-2007, 09:44 AM   #1
LQ Newbie
Registered: Mar 2007
Posts: 16

Rep: Reputation: 0
rpmbuild should not remove file while unistalling


Is there any way to specify by directive/modifier in %files section of a RPM spec file, that a file(server.ini) should be packaged in the RPM, and should be placed/copied when installing that RPM.

But it should not be removed when uninstalling/erasing the RPM package.

Like an user can save his preferences in the ini file. And I do not want to remove that file while erasing the package, so that when the user reinstalls the software he will have the previous ini settings available.

Old 06-26-2007, 06:02 PM   #2
Registered: May 2001
Posts: 29,358
Blog Entries: 55

Rep: Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545
Here's some reasons why this is a bad idea:

It breaks the concept of RPM
Any file (well, almost any) thats put on the system by an RPM can be traced back to it's originating package for identification and verification purposes. Leaving files breaks that since they don't belong to any package anymore.

It breaks the concept of RPM (II)
Remove means "remove unconditionally", not "remove but leave stuff in case you need it in a gazillion years, maybe". Leaving files that don't belong to any package are of no use to the system, especially if they're named something totally non-descriptive like "server.ini" (what server?). If they want to keep it they should make backups.

It breaks the concept of how personalised ini files should work
The general idea is that global ini files reside in any etc/* dirs and that users use their ~/.%{appname}.ini for personalising. If %{appname} doesn't look for ~/.%{appname}.ini then maybe it should. If it can't or shouldn't then that's still no reason to keep etc/%{appname}.ini.

And what happens on re-install if the RPM finds etc/%{appname}.ini is there? Should it forcefully overwrite? Leave it? (AFAIK %{config}(noreplace) only works for updating).

If you still want to go ahead I guess you could use "preun":
if [ "$1" = "0" ]; then
 if [ -f %{_sysconfdir}/%{appname}.ini ]; then
  mv %{_sysconfdir}/%{appname}.ini \


rpm, rpmbuild

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash remove part of a file based on contents of another file bhepdogg Programming 4 01-31-2007 03:13 PM
Problem with rpmbuild and template.spec file abefroman Linux - Software 0 11-27-2005 12:18 AM
ffmpeg srpm rpmbuild patch file? dtra Linux - Software 1 08-04-2005 07:25 PM
c++ file processing -- how to remove a record from a file sharonyiisl Programming 4 09-26-2004 03:54 AM
Problems with libpng not found when using rpmbuild on a .src file superduty455 Linux - Software 5 09-16-2004 03:15 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration